2025-04-25 06:53:17 +02:00

127096 lines
5.9 MiB
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/// <reference path="./gtk-4.0.d.ts" />
/// <reference path="./gsk-4.0.d.ts" />
/// <reference path="./graphene-1.0.d.ts" />
/// <reference path="./gobject-2.0.d.ts" />
/// <reference path="./glib-2.0.d.ts" />
/// <reference path="./gdk-4.0.d.ts" />
/// <reference path="./cairo-1.0.d.ts" />
/// <reference path="./cairo.d.ts" />
/// <reference path="./pangocairo-1.0.d.ts" />
/// <reference path="./pango-1.0.d.ts" />
/// <reference path="./harfbuzz-0.0.d.ts" />
/// <reference path="./freetype2-2.0.d.ts" />
/// <reference path="./gio-2.0.d.ts" />
/// <reference path="./gmodule-2.0.d.ts" />
/// <reference path="./gdkpixbuf-2.0.d.ts" />
/**
* 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://Adw?version=1' {
// Module dependencies
import type Gtk from 'gi://Gtk?version=4.0';
import type Gsk from 'gi://Gsk?version=4.0';
import type Graphene from 'gi://Graphene?version=1.0';
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
import type Gdk from 'gi://Gdk?version=4.0';
import type cairo from 'cairo';
import type PangoCairo from 'gi://PangoCairo?version=1.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';
export namespace Adw {
/**
* Adw-1
*/
/**
* Describes the available system accent colors.
*/
/**
* Describes the available system accent colors.
*/
export namespace AccentColor {
export const $gtype: GObject.GType<AccentColor>;
}
enum AccentColor {
/**
* Use a blue color (`#3584e4`). This is the default value.
*/
BLUE,
/**
* Use a teal color (`#2190a4`).
*/
TEAL,
/**
* Use a green color (`#3a944a`).
*/
GREEN,
/**
* Use a yellow color (`#c88800`).
*/
YELLOW,
/**
* Use a orange color (`#ed5b00`).
*/
ORANGE,
/**
* Use a red color (`#e62d42`).
*/
RED,
/**
* Use a pink color (`#d56199`).
*/
PINK,
/**
* Use a purple color (`#9141ac`).
*/
PURPLE,
/**
* Use a slate color (`#6f8396`).
*/
SLATE,
}
/**
* Describes the possible states of an [class`Animation]`.
*
* The state can be controlled with [method`Animation`.play],
* [method`Animation`.pause], [method`Animation`.resume],
* [method`Animation`.reset] and [method`Animation`.skip].
*/
/**
* Describes the possible states of an [class`Animation]`.
*
* The state can be controlled with [method`Animation`.play],
* [method`Animation`.pause], [method`Animation`.resume],
* [method`Animation`.reset] and [method`Animation`.skip].
*/
export namespace AnimationState {
export const $gtype: GObject.GType<AnimationState>;
}
enum AnimationState {
/**
* The animation hasn't started yet.
*/
IDLE,
/**
* The animation has been paused.
*/
PAUSED,
/**
* The animation is currently playing.
*/
PLAYING,
/**
* The animation has finished.
*/
FINISHED,
}
/**
* Describes the available button styles for [class`Banner]`.
*
* New values may be added to this enumeration over time.
*
* See [property`Banner:`button-style].
*/
/**
* Describes the available button styles for [class`Banner]`.
*
* New values may be added to this enumeration over time.
*
* See [property`Banner:`button-style].
*/
export namespace BannerButtonStyle {
export const $gtype: GObject.GType<BannerButtonStyle>;
}
enum BannerButtonStyle {
/**
* The default button style.
*/
DEFAULT,
/**
* A button in the suggested action style.
*/
SUGGESTED,
}
/**
* Describes length types for [struct`BreakpointCondition]`.
*
* See [ctor`BreakpointCondition`.new_length].
*
* New values may be added to this enumeration over time.
*/
/**
* Describes length types for [struct`BreakpointCondition]`.
*
* See [ctor`BreakpointCondition`.new_length].
*
* New values may be added to this enumeration over time.
*/
export namespace BreakpointConditionLengthType {
export const $gtype: GObject.GType<BreakpointConditionLengthType>;
}
enum BreakpointConditionLengthType {
/**
* true if the width is greater than or
* equal to the condition value
*/
MIN_WIDTH,
/**
* true if the width is less than or
* equal to the condition value
*/
MAX_WIDTH,
/**
* true if the height is greater than or
* equal to the condition value
*/
MIN_HEIGHT,
/**
* true if the height is less than or
* equal to the condition value
*/
MAX_HEIGHT,
}
/**
* Describes ratio types for [struct`BreakpointCondition]`.
*
* See [ctor`BreakpointCondition`.new_ratio].
*
* New values may be added to this enumeration over time.
*/
/**
* Describes ratio types for [struct`BreakpointCondition]`.
*
* See [ctor`BreakpointCondition`.new_ratio].
*
* New values may be added to this enumeration over time.
*/
export namespace BreakpointConditionRatioType {
export const $gtype: GObject.GType<BreakpointConditionRatioType>;
}
enum BreakpointConditionRatioType {
/**
* true if the aspect ratio is
* greater than or equal to the condition value
*/
MIN_ASPECT_RATIO,
/**
* true if the aspect ratio is
* less than or equal to the condition value
*/
MAX_ASPECT_RATIO,
}
/**
* Describes title centering behavior of a [class`HeaderBar]` widget.
*/
/**
* Describes title centering behavior of a [class`HeaderBar]` widget.
*/
export namespace CenteringPolicy {
export const $gtype: GObject.GType<CenteringPolicy>;
}
enum CenteringPolicy {
/**
* Keep the title centered when possible
*/
LOOSE,
/**
* Keep the title centered at all cost
*/
STRICT,
}
/**
* Application color schemes for [property`StyleManager:`color-scheme].
*/
/**
* Application color schemes for [property`StyleManager:`color-scheme].
*/
export namespace ColorScheme {
export const $gtype: GObject.GType<ColorScheme>;
}
enum ColorScheme {
/**
* Inherit the parent color-scheme. When set on the
* `AdwStyleManager` returned by [func`StyleManager`.get_default], it's
* equivalent to `ADW_COLOR_SCHEME_PREFER_LIGHT`.
*/
DEFAULT,
/**
* Always use light appearance.
*/
FORCE_LIGHT,
/**
* Use light appearance unless the system
* prefers dark colors.
*/
PREFER_LIGHT,
/**
* Use dark appearance unless the system prefers
* prefers light colors.
*/
PREFER_DARK,
/**
* Always use dark appearance.
*/
FORCE_DARK,
}
/**
* Describes the available presentation modes for [class`Dialog]`.
*
* New values may be added to this enumeration over time.
*
* See [property`Dialog:`presentation-mode].
*/
/**
* Describes the available presentation modes for [class`Dialog]`.
*
* New values may be added to this enumeration over time.
*
* See [property`Dialog:`presentation-mode].
*/
export namespace DialogPresentationMode {
export const $gtype: GObject.GType<DialogPresentationMode>;
}
enum DialogPresentationMode {
/**
* Switch between `ADW_DIALOG_FLOATING` and
* `ADW_DIALOG_BOTTOM_SHEET` depending on available size.
*/
AUTO,
/**
* Present dialog as a centered floating window.
*/
FLOATING,
/**
* Present dialog as a bottom sheet.
*/
BOTTOM_SHEET,
}
/**
* Describes the available easing functions for use with
* [class`TimedAnimation]`.
*
* New values may be added to this enumeration over time.
*/
/**
* Describes the available easing functions for use with
* [class`TimedAnimation]`.
*
* New values may be added to this enumeration over time.
*/
export namespace Easing {
export const $gtype: GObject.GType<Easing>;
}
enum Easing {
/**
* Linear tweening.
*/
LINEAR,
/**
* Quadratic tweening.
*/
EASE_IN_QUAD,
/**
* Quadratic tweening, inverse of `ADW_EASE_IN_QUAD`.
*/
EASE_OUT_QUAD,
/**
* Quadratic tweening, combining `ADW_EASE_IN_QUAD` and
* `ADW_EASE_OUT_QUAD`.
*/
EASE_IN_OUT_QUAD,
/**
* Cubic tweening.
*/
EASE_IN_CUBIC,
/**
* Cubic tweening, inverse of `ADW_EASE_IN_CUBIC`.
*/
EASE_OUT_CUBIC,
/**
* Cubic tweening, combining `ADW_EASE_IN_CUBIC` and
* `ADW_EASE_OUT_CUBIC`.
*/
EASE_IN_OUT_CUBIC,
/**
* Quartic tweening.
*/
EASE_IN_QUART,
/**
* Quartic tweening, inverse of `ADW_EASE_IN_QUART`.
*/
EASE_OUT_QUART,
/**
* Quartic tweening, combining `ADW_EASE_IN_QUART` and
* `ADW_EASE_OUT_QUART`.
*/
EASE_IN_OUT_QUART,
/**
* Quintic tweening.
*/
EASE_IN_QUINT,
/**
* Quintic tweening, inverse of `ADW_EASE_IN_QUINT`.
*/
EASE_OUT_QUINT,
/**
* Quintic tweening, combining `ADW_EASE_IN_QUINT` and
* `ADW_EASE_OUT_QUINT`.
*/
EASE_IN_OUT_QUINT,
/**
* Sine wave tweening.
*/
EASE_IN_SINE,
/**
* Sine wave tweening, inverse of `ADW_EASE_IN_SINE`.
*/
EASE_OUT_SINE,
/**
* Sine wave tweening, combining `ADW_EASE_IN_SINE` and
* `ADW_EASE_OUT_SINE`.
*/
EASE_IN_OUT_SINE,
/**
* Exponential tweening.
*/
EASE_IN_EXPO,
/**
* Exponential tweening, inverse of `ADW_EASE_IN_EXPO`.
*/
EASE_OUT_EXPO,
/**
* Exponential tweening, combining `ADW_EASE_IN_EXPO` and
* `ADW_EASE_OUT_EXPO`.
*/
EASE_IN_OUT_EXPO,
/**
* Circular tweening.
*/
EASE_IN_CIRC,
/**
* Circular tweening, inverse of `ADW_EASE_IN_CIRC`.
*/
EASE_OUT_CIRC,
/**
* Circular tweening, combining `ADW_EASE_IN_CIRC` and
* `ADW_EASE_OUT_CIRC`.
*/
EASE_IN_OUT_CIRC,
/**
* Elastic tweening, with offshoot on start.
*/
EASE_IN_ELASTIC,
/**
* Elastic tweening, with offshoot on end, inverse of
* `ADW_EASE_IN_ELASTIC`.
*/
EASE_OUT_ELASTIC,
/**
* Elastic tweening, with offshoot on both ends,
* combining `ADW_EASE_IN_ELASTIC` and `ADW_EASE_OUT_ELASTIC`.
*/
EASE_IN_OUT_ELASTIC,
/**
* Overshooting cubic tweening, with backtracking on start.
*/
EASE_IN_BACK,
/**
* Overshooting cubic tweening, with backtracking on end,
* inverse of `ADW_EASE_IN_BACK`.
*/
EASE_OUT_BACK,
/**
* Overshooting cubic tweening, with backtracking on both
* ends, combining `ADW_EASE_IN_BACK` and `ADW_EASE_OUT_BACK`.
*/
EASE_IN_OUT_BACK,
/**
* Exponentially decaying parabolic (bounce) tweening,
* on start.
*/
EASE_IN_BOUNCE,
/**
* Exponentially decaying parabolic (bounce) tweening,
* with bounce on end, inverse of `ADW_EASE_IN_BOUNCE`.
*/
EASE_OUT_BOUNCE,
/**
* Exponentially decaying parabolic (bounce) tweening,
* with bounce on both ends, combining `ADW_EASE_IN_BOUNCE` and
* `ADW_EASE_OUT_BOUNCE`.
*/
EASE_IN_OUT_BOUNCE,
/**
* Cubic bezier tweening, with control points in (0.25, 0.1) and (0.25, 1.0).
*
* Increases in velocity towards the middle of the animation, slowing back down
* at the end.
*/
EASE,
/**
* Cubic bezier tweening, with control points in (0.42, 0.0) and (1.0, 1.0).
*
* Starts off slowly, with the speed of the animation increasing until complete.
*/
EASE_IN,
/**
* Cubic bezier tweening, with control points in (0.0, 0.0) and (0.58, 1.0).
*
* Starts quickly, slowing down the animation until complete.
*/
EASE_OUT,
/**
* Cubic bezier tweening, with control points in (0.42, 0.0) and (0.58, 1.0).
*
* Starts off slowly, speeds up in the middle, and then slows down again.
*/
EASE_IN_OUT,
}
/**
* Describes the possible folding behavior of a [class`Flap]` widget.
*/
/**
* Describes the possible folding behavior of a [class`Flap]` widget.
*/
export namespace FlapFoldPolicy {
export const $gtype: GObject.GType<FlapFoldPolicy>;
}
enum FlapFoldPolicy {
/**
* Disable folding, the flap cannot reach narrow
* sizes.
*/
NEVER,
/**
* Keep the flap always folded.
*/
ALWAYS,
/**
* Fold and unfold the flap based on available
* space.
*/
AUTO,
}
/**
* Describes transitions types of a [class`Flap]` widget.
*
* It determines the type of animation when transitioning between children in a
* [class`Flap]` widget, as well as which areas can be swiped via
* [property`Flap:`swipe-to-open] and [property`Flap:`swipe-to-close].
*/
/**
* Describes transitions types of a [class`Flap]` widget.
*
* It determines the type of animation when transitioning between children in a
* [class`Flap]` widget, as well as which areas can be swiped via
* [property`Flap:`swipe-to-open] and [property`Flap:`swipe-to-close].
*/
export namespace FlapTransitionType {
export const $gtype: GObject.GType<FlapTransitionType>;
}
enum FlapTransitionType {
/**
* The flap slides over the content, which is
* dimmed. When folded, only the flap can be swiped.
*/
OVER,
/**
* The content slides over the flap. Only the
* content can be swiped.
*/
UNDER,
/**
* The flap slides offscreen when hidden,
* neither the flap nor content overlap each other. Both widgets can be
* swiped.
*/
SLIDE,
}
/**
* Determines when [class`Flap]` and [class`Leaflet]` will fold.
*/
/**
* Determines when [class`Flap]` and [class`Leaflet]` will fold.
*/
export namespace FoldThresholdPolicy {
export const $gtype: GObject.GType<FoldThresholdPolicy>;
}
enum FoldThresholdPolicy {
/**
* Folding is based on the minimum size
*/
MINIMUM,
/**
* Folding is based on the natural size
*/
NATURAL,
}
/**
* Describes what [class`InlineViewSwitcher]` toggles display.
*
* <picture>
* <source srcset="inline-view-switcher-display-modes-dark.png" media="(prefers-color-scheme: dark)">
* <img src="inline-view-switcher-display-modes.png" alt="inline-view-switcher-display-modes">
* </picture>
*/
/**
* Describes what [class`InlineViewSwitcher]` toggles display.
*
* <picture>
* <source srcset="inline-view-switcher-display-modes-dark.png" media="(prefers-color-scheme: dark)">
* <img src="inline-view-switcher-display-modes.png" alt="inline-view-switcher-display-modes">
* </picture>
*/
export namespace InlineViewSwitcherDisplayMode {
export const $gtype: GObject.GType<InlineViewSwitcherDisplayMode>;
}
enum InlineViewSwitcherDisplayMode {
/**
* Toggles only display labels.
*/
LABELS,
/**
* Toggles only display icons.
*/
ICONS,
/**
* Toggles display both icons and labels.
*/
BOTH,
}
/**
* Describes line justify behaviors in a [class`WrapLayout]` or [class`WrapBox]`.
*
* See [property`WrapLayout:`justify] and [property`WrapBox:`justify].
*/
/**
* Describes line justify behaviors in a [class`WrapLayout]` or [class`WrapBox]`.
*
* See [property`WrapLayout:`justify] and [property`WrapBox:`justify].
*/
export namespace JustifyMode {
export const $gtype: GObject.GType<JustifyMode>;
}
enum JustifyMode {
/**
* Don't justify children within a line.
*/
NONE,
/**
* Stretch each child within the line, keeping consistent
* spacing, so that the line fills the entire length.
*/
FILL,
/**
* Increase spacing between children, moving the children
* so that the first and last child are aligned with the beginning and end
* of the line. If the line only contains a single widget, it will be
* stretched regardless.
*/
SPREAD,
}
/**
* Describes the possible transitions in a [class`Leaflet]` widget.
*
* New values may be added to this enumeration over time.
*/
/**
* Describes the possible transitions in a [class`Leaflet]` widget.
*
* New values may be added to this enumeration over time.
*/
export namespace LeafletTransitionType {
export const $gtype: GObject.GType<LeafletTransitionType>;
}
enum LeafletTransitionType {
/**
* Cover the old page or uncover the new page, sliding from or towards the end according to orientation, text direction and children order
*/
OVER,
/**
* Uncover the new page or cover the old page, sliding from or towards the start according to orientation, text direction and children order
*/
UNDER,
/**
* Slide from left, right, up or down according to the orientation, text direction and the children order
*/
SLIDE,
}
/**
* Describes length units.
*
* | Unit | Regular Text | Large Text |
* | ---- | ------------ | ---------- |
* | 1px | 1px | 1px |
* | 1pt | 1.333333px | 1.666667px |
* | 1sp | 1px | 1.25px |
*
* New values may be added to this enumeration over time.
*/
/**
* Describes length units.
*
* | Unit | Regular Text | Large Text |
* | ---- | ------------ | ---------- |
* | 1px | 1px | 1px |
* | 1pt | 1.333333px | 1.666667px |
* | 1sp | 1px | 1.25px |
*
* New values may be added to this enumeration over time.
*/
export namespace LengthUnit {
export const $gtype: GObject.GType<LengthUnit>;
}
enum LengthUnit {
/**
* pixels
*/
PX,
/**
* points, changes with text scale factor
*/
PT,
/**
* scale independent pixels, changes with text scale factor
*/
SP,
}
/**
* Describes the direction of a swipe navigation gesture.
*/
/**
* Describes the direction of a swipe navigation gesture.
*/
export namespace NavigationDirection {
export const $gtype: GObject.GType<NavigationDirection>;
}
enum NavigationDirection {
/**
* Corresponds to start or top, depending on orientation and text direction
*/
BACK,
/**
* Corresponds to end or bottom, depending on orientation and text direction
*/
FORWARD,
}
/**
* Describes child packing behavior in a [class`WrapLayout]` or [class`WrapBox]`.
*
* See [property`WrapLayout:`pack-direction] and
* [property`WrapBox:`pack-direction].
*/
/**
* Describes child packing behavior in a [class`WrapLayout]` or [class`WrapBox]`.
*
* See [property`WrapLayout:`pack-direction] and
* [property`WrapBox:`pack-direction].
*/
export namespace PackDirection {
export const $gtype: GObject.GType<PackDirection>;
}
enum PackDirection {
/**
* Pack children from left to right for LTR languages,
* or top to bottom vertically.
*/
START_TO_END,
/**
* Pack children from right to left for LTR languages,
* or bottom to top vertically.
*/
END_TO_START,
}
/**
* Describes the possible styles of [class`AlertDialog]` response buttons.
*
* See [method`AlertDialog`.set_response_appearance].
*/
/**
* Describes the possible styles of [class`AlertDialog]` response buttons.
*
* See [method`AlertDialog`.set_response_appearance].
*/
export namespace ResponseAppearance {
export const $gtype: GObject.GType<ResponseAppearance>;
}
enum ResponseAppearance {
/**
* the default appearance.
*/
DEFAULT,
/**
* used to denote important responses such as the
* affirmative action.
*/
SUGGESTED,
/**
* used to draw attention to the potentially damaging
* consequences of using the response. This appearance acts as a warning to
* the user.
*/
DESTRUCTIVE,
}
/**
* Describes the possible transitions in a [class`Squeezer]` widget.
*/
/**
* Describes the possible transitions in a [class`Squeezer]` widget.
*/
export namespace SqueezerTransitionType {
export const $gtype: GObject.GType<SqueezerTransitionType>;
}
enum SqueezerTransitionType {
/**
* No transition
*/
NONE,
/**
* A cross-fade
*/
CROSSFADE,
}
/**
* [class`Toast]` behavior when another toast is already displayed.
*/
/**
* [class`Toast]` behavior when another toast is already displayed.
*/
export namespace ToastPriority {
export const $gtype: GObject.GType<ToastPriority>;
}
enum ToastPriority {
/**
* the toast will be queued if another toast is
* already displayed.
*/
NORMAL,
/**
* the toast will be displayed immediately, pushing
* the previous toast into the queue instead.
*/
HIGH,
}
/**
* Describes the possible top or bottom bar styles in an [class`ToolbarView]`
* widget.
*
* `ADW_TOOLBAR_FLAT` is suitable for simple content, such as
* [class`StatusPage]` or [class`PreferencesPage]`, where the background at the
* top and bottom parts of the page is uniform. Additionally, windows with
* sidebars should always use this style.
*
* <picture style="min-width: 33%; display: inline-block;">
* <source srcset="toolbar-view-flat-1-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toolbar-view-flat-1.png" alt="toolbar-view-flat-1">
* </picture>
* <picture style="min-width: 33%; display: inline-block;">
* <source srcset="toolbar-view-flat-2-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toolbar-view-flat-2.png" alt="toolbar-view-flat-2">
* </picture>
*
* `ADW_TOOLBAR_RAISED` style is suitable for content such as
* [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
* where some elements are directly adjacent to the top/bottom bars, or
* [class`TabView]`, where each page can have a different background.
*
* `ADW_TOOLBAR_RAISED_BORDER` style is similar to `ADW_TOOLBAR_RAISED`, but
* with the shadow replaced with a more subtle border. It's intended to be used
* in applications like image viewers, where a shadow over the content might be
* undesired.
*
* <picture style="min-width: 33%; display: inline-block;">
* <source srcset="toolbar-view-raised-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toolbar-view-raised.png" alt="toolbar-view-raised">
* </picture>
* <picture style="min-width: 33%; display: inline-block;">
* <source srcset="toolbar-view-raised-border-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toolbar-view-raised-border.png" alt="toolbar-view-raised-border">
* </picture>
*
* See [property`ToolbarView:`top-bar-style] and
* [property`ToolbarView:`bottom-bar-style].
*
* New values may be added to this enumeration over time.
*/
/**
* Describes the possible top or bottom bar styles in an [class`ToolbarView]`
* widget.
*
* `ADW_TOOLBAR_FLAT` is suitable for simple content, such as
* [class`StatusPage]` or [class`PreferencesPage]`, where the background at the
* top and bottom parts of the page is uniform. Additionally, windows with
* sidebars should always use this style.
*
* <picture style="min-width: 33%; display: inline-block;">
* <source srcset="toolbar-view-flat-1-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toolbar-view-flat-1.png" alt="toolbar-view-flat-1">
* </picture>
* <picture style="min-width: 33%; display: inline-block;">
* <source srcset="toolbar-view-flat-2-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toolbar-view-flat-2.png" alt="toolbar-view-flat-2">
* </picture>
*
* `ADW_TOOLBAR_RAISED` style is suitable for content such as
* [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
* where some elements are directly adjacent to the top/bottom bars, or
* [class`TabView]`, where each page can have a different background.
*
* `ADW_TOOLBAR_RAISED_BORDER` style is similar to `ADW_TOOLBAR_RAISED`, but
* with the shadow replaced with a more subtle border. It's intended to be used
* in applications like image viewers, where a shadow over the content might be
* undesired.
*
* <picture style="min-width: 33%; display: inline-block;">
* <source srcset="toolbar-view-raised-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toolbar-view-raised.png" alt="toolbar-view-raised">
* </picture>
* <picture style="min-width: 33%; display: inline-block;">
* <source srcset="toolbar-view-raised-border-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toolbar-view-raised-border.png" alt="toolbar-view-raised-border">
* </picture>
*
* See [property`ToolbarView:`top-bar-style] and
* [property`ToolbarView:`bottom-bar-style].
*
* New values may be added to this enumeration over time.
*/
export namespace ToolbarStyle {
export const $gtype: GObject.GType<ToolbarStyle>;
}
enum ToolbarStyle {
/**
* No background, shadow only for scrolled content
*/
FLAT,
/**
* Opaque background with a persistent shadow
*/
RAISED,
/**
* Opaque background with a persistent border
*/
RAISED_BORDER,
}
/**
* Describes the adaptive modes of [class`ViewSwitcher]`.
*/
/**
* Describes the adaptive modes of [class`ViewSwitcher]`.
*/
export namespace ViewSwitcherPolicy {
export const $gtype: GObject.GType<ViewSwitcherPolicy>;
}
enum ViewSwitcherPolicy {
/**
* Force the narrow mode
*/
NARROW,
/**
* Force the wide mode
*/
WIDE,
}
/**
* Describes line wrapping behavior in a [class`WrapLayout]` or [class`WrapBox]`.
*
* See [property`WrapLayout:`wrap-policy] and [property`WrapBox:`wrap-policy].
*/
/**
* Describes line wrapping behavior in a [class`WrapLayout]` or [class`WrapBox]`.
*
* See [property`WrapLayout:`wrap-policy] and [property`WrapBox:`wrap-policy].
*/
export namespace WrapPolicy {
export const $gtype: GObject.GType<WrapPolicy>;
}
enum WrapPolicy {
/**
* Fit as many children into each line as possible, shrinking
* them down to their minimum size before wrapping to the next line.
*/
MINIMUM,
/**
* Wrap to the next line as soon as the previous line cannot
* fit any more children without shrinking them past their natural size.
*/
NATURAL,
}
/**
* Indicates an [class`Animation]` with an infinite duration.
*
* This value is mostly used internally.
*/
const DURATION_INFINITE: number;
/**
* Adwaita major version component (e.g. 1 if the version is 1.2.3).
*/
const MAJOR_VERSION: number;
/**
* Adwaita micro version component (e.g. 3 if the version is 1.2.3).
*/
const MICRO_VERSION: number;
/**
* Adwaita minor version component (e.g. 2 if the version is 1.2.3).
*/
const MINOR_VERSION: number;
/**
* Adwaita version, encoded as a string, useful for printing and
* concatenation.
*/
const VERSION_S: string;
/**
* Converts `self` to a `GdkRGBA` representing its background color.
*
* The matching foreground color is white.
* @param self an accent color
*/
function accent_color_to_rgba(self: AccentColor | null): Gdk.RGBA;
/**
* Converts `self` to a `GdkRGBA` representing its standalone color.
*
* It will typically be darker for light background, and lighter for dark
* background, ensuring contrast.
* @param self an accent color
* @param dark Whether to calculate standalone color for light or dark background
*/
function accent_color_to_standalone_rgba(self: AccentColor | null, dark: boolean): Gdk.RGBA;
/**
* Parses a condition from a string.
*
* Length conditions are specified as `<type>: <value>[<unit>]`, where:
*
* - `<type>` can be `min-width`, `max-width`, `min-height` or `max-height`
* - `<value>` is a fractional number
* - `<unit>` can be `px`, `pt` or `sp`
*
* If the unit is omitted, `px` is assumed.
*
* See [ctor`BreakpointCondition`.new_length].
*
* Examples:
*
* - `min-width: 500px`
* - `min-height: 400pt`
* - `max-width: 100sp`
* - `max-height: 500`
*
* Ratio conditions are specified as `<type>: <width>[/<height>]`, where:
*
* - `<type>` can be `min-aspect-ratio` or `max-aspect-ratio`
* - `<width>` and `<height>` are integer numbers
*
* See [ctor`BreakpointCondition`.new_ratio].
*
* The ratio is represented as `<width>` divided by `<height>`.
*
* If `<height>` is omitted, it's assumed to be 1.
*
* Examples:
*
* - `min-aspect-ratio: 4/3`
* - `max-aspect-ratio: 1`
*
* The logical operators `and`, `or` can be used to compose a complex condition
* as follows:
*
* - `<condition> and <condition>`: the condition is true when both
* `<condition>`s are true, same as when using
* [ctor`BreakpointCondition`.new_and]
* - `<condition> or <condition>`: the condition is true when either of the
* `<condition>`s is true, same as when using
* [ctor`BreakpointCondition`.new_or]
*
* Examples:
*
* - `min-width: 400px and max-aspect-ratio: 4/3`
* - `max-width: 360sp or max-width: 360px`
*
* Conditions can be further nested using parentheses, for example:
*
* - `min-width: 400px and (max-aspect-ratio: 4/3 or max-height: 400px)`
*
* If parentheses are omitted, the first operator takes priority.
* @param str the string specifying the condition
* @returns the parsed condition
*/
function breakpoint_condition_parse(str: string): BreakpointCondition;
/**
* Computes easing with `easing` for `value`.
*
* `value` should generally be in the [0, 1] range.
* @param self an easing value
* @param value a value to ease
* @returns the easing for @value
*/
function easing_ease(self: Easing | null, value: number): number;
/**
* Checks whether animations are enabled for `widget`.
*
* This should be used when implementing an animated widget to know whether to
* animate it or not.
* @param widget a `GtkWidget`
* @returns whether animations are enabled for @widget
*/
function get_enable_animations(widget: Gtk.Widget): boolean;
/**
* Returns the major version number of the Adwaita library.
*
* For example, in libadwaita version 1.2.3 this is 1.
*
* This function is in the library, so it represents the libadwaita library your
* code is running against. Contrast with the [const`MAJOR_VERSION]` constant,
* which represents the major version of the libadwaita headers you have
* included when compiling your code.
* @returns the major version number of the Adwaita library
*/
function get_major_version(): number;
/**
* Returns the micro version number of the Adwaita library.
*
* For example, in libadwaita version 1.2.3 this is 3.
*
* This function is in the library, so it represents the libadwaita library your
* code is running against. Contrast with the [const`MAJOR_VERSION]` constant,
* which represents the micro version of the libadwaita headers you have
* included when compiling your code.
* @returns the micro version number of the Adwaita library
*/
function get_micro_version(): number;
/**
* Returns the minor version number of the Adwaita library.
*
* For example, in libadwaita version 1.2.3 this is 2.
*
* This function is in the library, so it represents the libadwaita library your
* code is running against. Contrast with the [const`MAJOR_VERSION]` constant,
* which represents the minor version of the libadwaita headers you have
* included when compiling your code.
* @returns the minor version number of the Adwaita library
*/
function get_minor_version(): number;
/**
* Initializes Libadwaita.
*
* This function can be used instead of [func`Gtk`.init] as it initializes GTK
* implicitly.
*
* There's no need to call this function if you're using [class`Application]`.
*
* If Libadwaita has already been initialized, the function will simply return.
*
* This makes sure translations, types, themes, and icons for the Adwaita
* library are set up properly.
*/
function init(): void;
/**
* Use this function to check if libadwaita has been initialized with
* [func`init]`.
* @returns the initialization status
*/
function is_initialized(): boolean;
/**
* Converts `value` from pixels to `unit`.
* @param unit a length unit
* @param value a value in pixels
* @param settings settings to use, or `NULL` for default settings
* @returns the length in @unit
*/
function length_unit_from_px(unit: LengthUnit | null, value: number, settings?: Gtk.Settings | null): number;
/**
* Converts `value` from `unit` to pixels.
* @param unit a length unit
* @param value a value in @unit
* @param settings settings to use, or `NULL` for default settings
* @returns the length in pixels
*/
function length_unit_to_px(unit: LengthUnit | null, value: number, settings?: Gtk.Settings | null): number;
/**
* Computes the linear interpolation between `a` and `b` for `t`.
* @param a the start
* @param b the end
* @param t the interpolation rate
* @returns the computed value
*/
function lerp(a: number, b: number, t: number): number;
/**
* Adjusts `rgba` to be suitable as a standalone color.
*
* It will typically be darker for light background, and lighter for dark
* background, ensuring contrast.
* @param rgba a background color
* @param dark Whether to calculate standalone color for light or dark background
*/
function rgba_to_standalone(rgba: Gdk.RGBA, dark: boolean): Gdk.RGBA;
interface AnimationTargetFunc {
(value: number): void;
}
/**
* Describes available shortcuts in an [class`TabView]`.
*
* Shortcuts can be set with [property`TabView:`shortcuts], or added/removed
* individually with [method`TabView`.add_shortcuts] and
* [method`TabView`.remove_shortcuts].
*
* New values may be added to this enumeration over time.
*/
/**
* Describes available shortcuts in an [class`TabView]`.
*
* Shortcuts can be set with [property`TabView:`shortcuts], or added/removed
* individually with [method`TabView`.add_shortcuts] and
* [method`TabView`.remove_shortcuts].
*
* New values may be added to this enumeration over time.
*/
export namespace TabViewShortcuts {
export const $gtype: GObject.GType<TabViewShortcuts>;
}
enum TabViewShortcuts {
/**
* No shortcuts
*/
NONE,
/**
* <kbd>Ctrl</kbd>+<kbd>Tab</kbd> - switch to the next page
*/
CONTROL_TAB,
/**
* <kbd>Shift</kbd>+<kbd>Ctrl</kbd>+<kbd>Tab</kbd> - switch to the previous
* page
*/
CONTROL_SHIFT_TAB,
/**
* <kbd>Ctrl</kbd>+<kbd>Page Up</kbd> - switch to the previous page
*/
CONTROL_PAGE_UP,
/**
* <kbd>Ctrl</kbd>+<kbd>Page Down</kbd> - switch to the next page
*/
CONTROL_PAGE_DOWN,
/**
* <kbd>Ctrl</kbd>+<kbd>Home</kbd> - switch to the first page
*/
CONTROL_HOME,
/**
* <kbd>Ctrl</kbd>+<kbd>End</kbd> - switch to the last page
*/
CONTROL_END,
/**
* <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Page Up</kbd> - move the selected
* page backward
*/
CONTROL_SHIFT_PAGE_UP,
/**
* <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Page Down</kbd> - move the selected
* page forward
*/
CONTROL_SHIFT_PAGE_DOWN,
/**
* <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Home</kbd> - move the selected page
* at the start
*/
CONTROL_SHIFT_HOME,
/**
* <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>End</kbd> - move the current page at
* the end
*/
CONTROL_SHIFT_END,
/**
* <kbd>Alt</kbd>+<kbd>1</kbd>⋯<kbd>9</kbd> - switch to pages 1-9
*/
ALT_DIGITS,
/**
* <kbd>Alt</kbd>+<kbd>0</kbd> - switch to page 10
*/
ALT_ZERO,
/**
* All of the shortcuts
*/
ALL_SHORTCUTS,
}
namespace AboutDialog {
// Signal callback interfaces
interface ActivateLink {
(uri: string): boolean;
}
// Constructor properties interface
interface ConstructorProps
extends Dialog.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.ShortcutManager.ConstructorProps {
application_icon: string;
applicationIcon: string;
application_name: string;
applicationName: string;
artists: string[];
comments: string;
copyright: string;
debug_info: string;
debugInfo: string;
debug_info_filename: string;
debugInfoFilename: string;
designers: string[];
developer_name: string;
developerName: string;
developers: string[];
documenters: string[];
issue_url: string;
issueUrl: string;
license: string;
license_type: Gtk.License;
licenseType: Gtk.License;
release_notes: string;
releaseNotes: string;
release_notes_version: string;
releaseNotesVersion: string;
support_url: string;
supportUrl: string;
translator_credits: string;
translatorCredits: string;
version: string;
website: string;
}
}
/**
* A dialog showing information about the application.
*
* <picture>
* <source srcset="about-dialog-dark.png" media="(prefers-color-scheme: dark)">
* <img src="about-dialog.png" alt="about-dialog">
* </picture>
*
* an about dialog is typically opened when the user activates the `About …`
* item in the application's primary menu. All parts of the dialog are optional.
*
* ## Main page
*
* `AdwAboutDialog` prominently displays the application's icon, name, developer
* name and version. They can be set with the [property`AboutDialog:`application-icon],
* [property`AboutDialog:`application-name],
* [property`AboutDialog:`developer-name] and [property`AboutDialog:`version]
* respectively.
*
* ## What's New
*
* `AdwAboutDialog` provides a way for applications to display their release
* notes, set with the [property`AboutDialog:`release-notes] property.
*
* Release notes are formatted the same way as
* [AppStream descriptions](https://freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-description).
*
* The supported formatting options are:
*
* * Paragraph (`<p>`)
* * Ordered list (`<ol>`), with list items (`<li>`)
* * Unordered list (`<ul>`), with list items (`<li>`)
*
* Within paragraphs and list items, emphasis (`<em>`) and inline code
* (`<code>`) text styles are supported. The emphasis is rendered in italic,
* while inline code is shown in a monospaced font.
*
* Any text outside paragraphs or list items is ignored.
*
* Nested lists are not supported.
*
* Only one version can be shown at a time. By default, the displayed version
* number matches [property`AboutDialog:`version]. Use
* [property`AboutDialog:`release-notes-version] to override it.
*
* ## Details
*
* The Details page displays the application comments and links.
*
* The comments can be set with the [property`AboutDialog:`comments] property.
* Unlike [property`Gtk`.AboutDialog:comments], this string can be long and
* detailed. It can also contain links and Pango markup.
*
* To set the application website, use [property`AboutDialog:`website].
* To add extra links below the website, use [method`AboutDialog`.add_link].
*
* If the Details page doesn't have any other content besides website, the
* website will be displayed on the main page instead.
*
* ## Troubleshooting
*
* `AdwAboutDialog` displays the following two links on the main page:
*
* * Support Questions, set with the [property`AboutDialog:`support-url] property,
* * Report an Issue, set with the [property`AboutDialog:`issue-url] property.
*
* Additionally, applications can provide debugging information. It will be
* shown separately on the Troubleshooting page. Use the
* [property`AboutDialog:`debug-info] property to specify it.
*
* It's intended to be attached to issue reports when reporting issues against
* the application. As such, it cannot contain markup or links.
*
* `AdwAboutDialog` provides a quick way to save debug information to a file.
* When saving, [property`AboutDialog:`debug-info-filename] would be used as
* the suggested filename.
*
* ## Credits and Acknowledgements
*
* The Credits page has the following default sections:
*
* * Developers, set with the [property`AboutDialog:`developers] property,
* * Designers, set with the [property`AboutDialog:`designers] property,
* * Artists, set with the [property`AboutDialog:`artists] property,
* * Documenters, set with the [property`AboutDialog:`documenters] property,
* * Translators, set with the [property`AboutDialog:`translator-credits] property.
*
* When setting translator credits, use the strings `"translator-credits"` or
* `"translator_credits"` and mark them as translatable.
*
* The default sections that don't contain any names won't be displayed.
*
* The Credits page can also contain an arbitrary number of extra sections below
* the default ones. Use [method`AboutDialog`.add_credit_section] to add them.
*
* The Acknowledgements page can be used to acknowledge additional people and
* organizations for their non-development contributions. Use
* [method`AboutDialog`.add_acknowledgement_section] to add sections to it. For
* example, it can be used to list backers in a crowdfunded project or to give
* special thanks.
*
* Each of the people or organizations can have an email address or a website
* specified. To add a email address, use a string like
* `Edgar Allan Poe <edgar`poe`.com>`. To specify a website with a title, use a
* string like `The GNOME Project https://www.gnome.org`:
*
* <picture>
* <source srcset="about-dialog-credits-dark.png" media="(prefers-color-scheme: dark)">
* <img src="about-dialog-credits.png" alt="about-dialog-credits">
* </picture>
*
* ## Legal
*
* The Legal page displays the copyright and licensing information for the
* application and other modules.
*
* The copyright string is set with the [property`AboutDialog:`copyright]
* property and should be a short string of one or two lines, for example:
* `© 2022 Example`.
*
* Licensing information can be quickly set from a list of known licenses with
* the [property`AboutDialog:`license-type] property. If the application's
* license is not in the list, [property`AboutDialog:`license] can be used
* instead.
*
* To add information about other modules, such as application dependencies or
* data, use [method`AboutDialog`.add_legal_section].
*
* ## Other applications
*
* `AdwAboutDialog` can show links to your other apps at the end of the main
* page. To add them, use [method`AboutDialog`.add_other_app].
*
* ## Constructing
*
* To make constructing an `AdwAboutDialog` as convenient as possible, you can
* use the function [func`show_about_dialog]` which constructs and shows a
* dialog.
*
* ```c
* static void
* show_about (GtkApplication *app)
* {
* const char *developers[] = {
* "Angela Avery",
* NULL
* };
*
* const char *designers[] = {
* "GNOME Design Team",
* NULL
* };
*
* adw_show_about_dialog (GTK_WIDGET (gtk_application_get_active_window (app)),
* "application-name", _("Example"),
* "application-icon", "org.example.App",
* "version", "1.2.3",
* "copyright", "© 2022 Angela Avery",
* "issue-url", "https://gitlab.gnome.org/example/example/-/issues/",
* "license-type", GTK_LICENSE_GPL_3_0,
* "developers", developers,
* "designers", designers,
* "translator-credits", _("translator-credits"),
* NULL);
* }
* ```
*
* ## CSS nodes
*
* `AdwAboutDialog` has a main CSS node with the name `dialog` and the
* style class `.about`.
*/
class AboutDialog
extends Dialog
implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.ShortcutManager
{
static $gtype: GObject.GType<AboutDialog>;
// Properties
/**
* The name of the application icon.
*
* The icon is displayed at the top of the main page.
*/
get application_icon(): string;
set application_icon(val: string);
/**
* The name of the application icon.
*
* The icon is displayed at the top of the main page.
*/
get applicationIcon(): string;
set applicationIcon(val: string);
/**
* The name of the application.
*
* The name is displayed at the top of the main page.
*/
get application_name(): string;
set application_name(val: string);
/**
* The name of the application.
*
* The name is displayed at the top of the main page.
*/
get applicationName(): string;
set applicationName(val: string);
/**
* The list of artists of the application.
*
* It will be displayed on the Credits page.
*
* Each name may contain email addresses and URLs, see the introduction for
* more details.
*
* See also:
*
* * [property`AboutDialog:`developers]
* * [property`AboutDialog:`designers]
* * [property`AboutDialog:`documenters]
* * [property`AboutDialog:`translator-credits]
* * [method`AboutDialog`.add_credit_section]
* * [method`AboutDialog`.add_acknowledgement_section]
*/
get artists(): string[];
set artists(val: string[]);
/**
* The comments about the application.
*
* Comments will be shown on the Details page, above links.
*
* Unlike [property`Gtk`.AboutDialog:comments], this string can be long and
* detailed. It can also contain links and Pango markup.
*/
get comments(): string;
set comments(val: string);
/**
* The copyright information.
*
* This should be a short string of one or two lines, for example:
* `© 2022 Example`.
*
* The copyright information will be displayed on the Legal page, above the
* application license.
*
* [method`AboutDialog`.add_legal_section] can be used to add copyright
* information for the application dependencies or other components.
*/
get copyright(): string;
set copyright(val: string);
/**
* The debug information.
*
* Debug information will be shown on the Troubleshooting page. It's intended
* to be attached to issue reports when reporting issues against the
* application.
*
* `AdwAboutDialog` provides a quick way to save debug information to a file.
* When saving, [property`AboutDialog:`debug-info-filename] would be used as
* the suggested filename.
*
* Debug information cannot contain markup or links.
*/
get debug_info(): string;
set debug_info(val: string);
/**
* The debug information.
*
* Debug information will be shown on the Troubleshooting page. It's intended
* to be attached to issue reports when reporting issues against the
* application.
*
* `AdwAboutDialog` provides a quick way to save debug information to a file.
* When saving, [property`AboutDialog:`debug-info-filename] would be used as
* the suggested filename.
*
* Debug information cannot contain markup or links.
*/
get debugInfo(): string;
set debugInfo(val: string);
/**
* The debug information filename.
*
* It will be used as the suggested filename when saving debug information to
* a file.
*
* See [property`AboutDialog:`debug-info].
*/
get debug_info_filename(): string;
set debug_info_filename(val: string);
/**
* The debug information filename.
*
* It will be used as the suggested filename when saving debug information to
* a file.
*
* See [property`AboutDialog:`debug-info].
*/
get debugInfoFilename(): string;
set debugInfoFilename(val: string);
/**
* The list of designers of the application.
*
* It will be displayed on the Credits page.
*
* Each name may contain email addresses and URLs, see the introduction for
* more details.
*
* See also:
*
* * [property`AboutDialog:`developers]
* * [property`AboutDialog:`artists]
* * [property`AboutDialog:`documenters]
* * [property`AboutDialog:`translator-credits]
* * [method`AboutDialog`.add_credit_section]
* * [method`AboutDialog`.add_acknowledgement_section]
*/
get designers(): string[];
set designers(val: string[]);
/**
* The developer name.
*
* The developer name is displayed on the main page, under the application
* name.
*
* If the application is developed by multiple people, the developer name can
* be set to values like "AppName team", "AppName developers" or
* "The AppName project", and the individual contributors can be listed on the
* Credits page, with [property`AboutDialog:`developers] and related
* properties.
*/
get developer_name(): string;
set developer_name(val: string);
/**
* The developer name.
*
* The developer name is displayed on the main page, under the application
* name.
*
* If the application is developed by multiple people, the developer name can
* be set to values like "AppName team", "AppName developers" or
* "The AppName project", and the individual contributors can be listed on the
* Credits page, with [property`AboutDialog:`developers] and related
* properties.
*/
get developerName(): string;
set developerName(val: string);
/**
* The list of developers of the application.
*
* It will be displayed on the Credits page.
*
* Each name may contain email addresses and URLs, see the introduction for
* more details.
*
* See also:
*
* * [property`AboutDialog:`designers]
* * [property`AboutDialog:`artists]
* * [property`AboutDialog:`documenters]
* * [property`AboutDialog:`translator-credits]
* * [method`AboutDialog`.add_credit_section]
* * [method`AboutDialog`.add_acknowledgement_section]
*/
get developers(): string[];
set developers(val: string[]);
/**
* The list of documenters of the application.
*
* It will be displayed on the Credits page.
*
* Each name may contain email addresses and URLs, see the introduction for
* more details.
*
* See also:
*
* * [property`AboutDialog:`developers]
* * [property`AboutDialog:`designers]
* * [property`AboutDialog:`artists]
* * [property`AboutDialog:`translator-credits]
* * [method`AboutDialog`.add_credit_section]
* * [method`AboutDialog`.add_acknowledgement_section]
*/
get documenters(): string[];
set documenters(val: string[]);
/**
* The URL for the application's issue tracker.
*
* The issue tracker link is displayed on the main page.
*/
get issue_url(): string;
set issue_url(val: string);
/**
* The URL for the application's issue tracker.
*
* The issue tracker link is displayed on the main page.
*/
get issueUrl(): string;
set issueUrl(val: string);
/**
* The license text.
*
* This can be used to set a custom text for the license if it can't be set
* via [property`AboutDialog:`license-type].
*
* When set, [property`AboutDialog:`license-type] will be set to
* `GTK_LICENSE_CUSTOM`.
*
* The license text will be displayed on the Legal page, below the copyright
* information.
*
* License text can contain Pango markup and links.
*
* [method`AboutDialog`.add_legal_section] can be used to add license
* information for the application dependencies or other components.
*/
get license(): string;
set license(val: string);
/**
* The license type.
*
* Allows to set the application's license froma list of known licenses.
*
* If the application's license is not in the list,
* [property`AboutDialog:`license] can be used instead. The license type will
* be automatically set to `GTK_LICENSE_CUSTOM` in that case.
*
* If set to `GTK_LICENSE_UNKNOWN`, no information will be displayed.
*
* If the license type is different from `GTK_LICENSE_CUSTOM`.
* [property`AboutDialog:`license] will be cleared out.
*
* The license description will be displayed on the Legal page, below the
* copyright information.
*
* [method`AboutDialog`.add_legal_section] can be used to add license
* information for the application dependencies or other components.
*/
get license_type(): Gtk.License;
set license_type(val: Gtk.License);
/**
* The license type.
*
* Allows to set the application's license froma list of known licenses.
*
* If the application's license is not in the list,
* [property`AboutDialog:`license] can be used instead. The license type will
* be automatically set to `GTK_LICENSE_CUSTOM` in that case.
*
* If set to `GTK_LICENSE_UNKNOWN`, no information will be displayed.
*
* If the license type is different from `GTK_LICENSE_CUSTOM`.
* [property`AboutDialog:`license] will be cleared out.
*
* The license description will be displayed on the Legal page, below the
* copyright information.
*
* [method`AboutDialog`.add_legal_section] can be used to add license
* information for the application dependencies or other components.
*/
get licenseType(): Gtk.License;
set licenseType(val: Gtk.License);
/**
* The release notes of the application.
*
* Release notes are displayed on the the What's New page.
*
* Release notes are formatted the same way as
* [AppStream descriptions](https://freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-description).
*
* The supported formatting options are:
*
* * Paragraph (`<p>`)
* * Ordered list (`<ol>`), with list items (`<li>`)
* * Unordered list (`<ul>`), with list items (`<li>`)
*
* Within paragraphs and list items, emphasis (`<em>`) and inline code
* (`<code>`) text styles are supported. The emphasis is rendered in italic,
* while inline code is shown in a monospaced font.
*
* Any text outside paragraphs or list items is ignored.
*
* Nested lists are not supported.
*
* `AdwAboutDialog` displays the version above the release notes. If set, the
* [property`AboutDialog:`release-notes-version] of the property will be used
* as the version; otherwise, [property`AboutDialog:`version] is used.
*/
get release_notes(): string;
set release_notes(val: string);
/**
* The release notes of the application.
*
* Release notes are displayed on the the What's New page.
*
* Release notes are formatted the same way as
* [AppStream descriptions](https://freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-description).
*
* The supported formatting options are:
*
* * Paragraph (`<p>`)
* * Ordered list (`<ol>`), with list items (`<li>`)
* * Unordered list (`<ul>`), with list items (`<li>`)
*
* Within paragraphs and list items, emphasis (`<em>`) and inline code
* (`<code>`) text styles are supported. The emphasis is rendered in italic,
* while inline code is shown in a monospaced font.
*
* Any text outside paragraphs or list items is ignored.
*
* Nested lists are not supported.
*
* `AdwAboutDialog` displays the version above the release notes. If set, the
* [property`AboutDialog:`release-notes-version] of the property will be used
* as the version; otherwise, [property`AboutDialog:`version] is used.
*/
get releaseNotes(): string;
set releaseNotes(val: string);
/**
* The version described by the application's release notes.
*
* The release notes version is displayed on the What's New page, above the
* release notes.
*
* If not set, [property`AboutDialog:`version] will be used instead.
*
* For example, an application with the current version 2.0.2 might want to
* keep the release notes from 2.0.0, and set the release notes version
* accordingly.
*
* See [property`AboutDialog:`release-notes].
*/
get release_notes_version(): string;
set release_notes_version(val: string);
/**
* The version described by the application's release notes.
*
* The release notes version is displayed on the What's New page, above the
* release notes.
*
* If not set, [property`AboutDialog:`version] will be used instead.
*
* For example, an application with the current version 2.0.2 might want to
* keep the release notes from 2.0.0, and set the release notes version
* accordingly.
*
* See [property`AboutDialog:`release-notes].
*/
get releaseNotesVersion(): string;
set releaseNotesVersion(val: string);
/**
* The URL of the application's support page.
*
* The support page link is displayed on the main page.
*/
get support_url(): string;
set support_url(val: string);
/**
* The URL of the application's support page.
*
* The support page link is displayed on the main page.
*/
get supportUrl(): string;
set supportUrl(val: string);
/**
* The translator credits string.
*
* It will be displayed on the Credits page.
*
* This string should be `"translator-credits"` or `"translator_credits"` and
* should be marked as translatable.
*
* The string may contain email addresses and URLs, see the introduction for
* more details.
*
* See also:
*
* * [property`AboutDialog:`developers]
* * [property`AboutDialog:`designers]
* * [property`AboutDialog:`artists]
* * [property`AboutDialog:`documenters]
* * [method`AboutDialog`.add_credit_section]
* * [method`AboutDialog`.add_acknowledgement_section]
*/
get translator_credits(): string;
set translator_credits(val: string);
/**
* The translator credits string.
*
* It will be displayed on the Credits page.
*
* This string should be `"translator-credits"` or `"translator_credits"` and
* should be marked as translatable.
*
* The string may contain email addresses and URLs, see the introduction for
* more details.
*
* See also:
*
* * [property`AboutDialog:`developers]
* * [property`AboutDialog:`designers]
* * [property`AboutDialog:`artists]
* * [property`AboutDialog:`documenters]
* * [method`AboutDialog`.add_credit_section]
* * [method`AboutDialog`.add_acknowledgement_section]
*/
get translatorCredits(): string;
set translatorCredits(val: string);
/**
* The version of the application.
*
* The version is displayed on the main page.
*
* If [property`AboutDialog:`release-notes-version] is not set, the version
* will also be displayed above the release notes on the What's New page.
*/
get version(): string;
set version(val: string);
/**
* The URL of the application's website.
*
* Website is displayed on the Details page, below comments, or on the main
* page if the Details page doesn't have any other content.
*
* Applications can add other links below, see [method`AboutDialog`.add_link].
*/
get website(): string;
set website(val: string);
// Constructors
constructor(properties?: Partial<AboutDialog.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): AboutDialog;
static new_from_appdata(resource_path: string, release_notes_version?: string | null): AboutDialog;
// 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-link', callback: (_source: this, uri: string) => boolean): number;
connect_after(signal: 'activate-link', callback: (_source: this, uri: string) => boolean): number;
emit(signal: 'activate-link', uri: string): void;
// Methods
/**
* Adds a section to the Acknowledgements page.
*
* This can be used to acknowledge additional people and organizations for their
* non-development contributions - for example, backers in a crowdfunded
* project.
*
* Each name may contain email addresses and URLs, see the introduction for more
* details.
*
* See also:
*
* * [property`AboutDialog:`developers]
* * [property`AboutDialog:`designers]
* * [property`AboutDialog:`artists]
* * [property`AboutDialog:`documenters]
* * [property`AboutDialog:`translator-credits]
* * [method`AboutDialog`.add_credit_section]
* @param name the section name
* @param people the list of names
*/
add_acknowledgement_section(name: string | null, people: string[]): void;
/**
* Adds an extra section to the Credits page.
*
* Extra sections are displayed below the standard categories.
*
* Each name may contain email addresses and URLs, see the introduction for more
* details.
*
* See also:
*
* * [property`AboutDialog:`developers]
* * [property`AboutDialog:`designers]
* * [property`AboutDialog:`artists]
* * [property`AboutDialog:`documenters]
* * [property`AboutDialog:`translator-credits]
* * [method`AboutDialog`.add_acknowledgement_section]
* @param name the section name
* @param people the list of names
*/
add_credit_section(name: string | null, people: string[]): void;
/**
* Adds an extra section to the Legal page.
*
* Extra sections will be displayed below the application's own information.
*
* The parameters `copyright,` `license_type` and `license` will be used to present
* the it the same way as [property`AboutDialog:`copyright],
* [property`AboutDialog:`license-type] and [property`AboutDialog:`license] are
* for the application's own information.
*
* See those properties for more details.
*
* This can be useful to attribute the application dependencies or data.
*
* Examples:
*
* ```c
* adw_about_dialog_add_legal_section (ADW_ABOUT_DIALOG (about),
* _("Copyright and a known license"),
* "© 2022 Example",
* GTK_LICENSE_LGPL_2_1,
* NULL);
*
* adw_about_dialog_add_legal_section (ADW_ABOUT_DIALOG (about),
* _("Copyright and custom license"),
* "© 2022 Example",
* GTK_LICENSE_CUSTOM,
* "Custom license text");
*
* adw_about_dialog_add_legal_section (ADW_ABOUT_DIALOG (about),
* _("Copyright only"),
* "© 2022 Example",
* GTK_LICENSE_UNKNOWN,
* NULL);
*
* adw_about_dialog_add_legal_section (ADW_ABOUT_DIALOG (about),
* _("Custom license only"),
* NULL,
* GTK_LICENSE_CUSTOM,
* "Something completely custom here.");
* ```
* @param title the name of the section
* @param copyright a copyright string
* @param license_type the type of license
* @param license custom license information
*/
add_legal_section(
title: string,
copyright: string | null,
license_type: Gtk.License | null,
license?: string | null,
): void;
/**
* Adds an extra link to the Details page.
*
* Extra links are displayed under the comment and website.
*
* Underlines in `title` will be interpreted as indicating a mnemonic.
*
* See [property`AboutDialog:`website].
* @param title the link title
* @param url the link URL
*/
add_link(title: string, url: string): void;
/**
* Adds another application to `self`.
*
* The application will be displayed at the bottom of the main page, in a
* separate section. Each added application will be presented as a row with
* `title` and `summary,` as well as an icon with the name `appid`. Clicking the
* row will show `appid` in the software center app.
*
* This can be used to link to your other applications if you have multiple.
*
* Example:
*
* ```c
* adw_about_dialog_add_other_app (ADW_ABOUT_DIALOG (about),
* "org.gnome.Boxes",
* _("Boxes"),
* _("Virtualization made simple"));
* ```
* @param appid the application ID
* @param name the application name
* @param summary the application summary
*/
add_other_app(appid: string, name: string, summary: string): void;
/**
* Gets the name of the application icon for `self`.
* @returns the application icon name
*/
get_application_icon(): string;
/**
* Gets the application name for `self`.
* @returns the application name
*/
get_application_name(): string;
/**
* Gets the list of artists of the application.
* @returns The list of artists
*/
get_artists(): string[] | null;
/**
* Gets the comments about the application.
* @returns the comments
*/
get_comments(): string;
/**
* Gets the copyright information for `self`.
* @returns the copyright information
*/
get_copyright(): string;
/**
* Gets the debug information for `self`.
* @returns the debug information
*/
get_debug_info(): string;
/**
* Gets the debug information filename for `self`.
* @returns the debug information filename
*/
get_debug_info_filename(): string;
/**
* Gets the list of designers of the application.
* @returns The list of designers
*/
get_designers(): string[] | null;
/**
* Gets the developer name for `self`.
* @returns the developer_name
*/
get_developer_name(): string;
/**
* Gets the list of developers of the application.
* @returns The list of developers
*/
get_developers(): string[] | null;
/**
* Gets the list of documenters of the application.
* @returns The list of documenters
*/
get_documenters(): string[] | null;
/**
* Gets the issue tracker URL for `self`.
* @returns the issue tracker URL
*/
get_issue_url(): string;
/**
* Gets the license for `self`.
* @returns the license
*/
get_license(): string;
/**
* Gets the license type for `self`.
* @returns the license type
*/
get_license_type(): Gtk.License;
/**
* Gets the release notes for `self`.
* @returns the release notes
*/
get_release_notes(): string;
/**
* Gets the version described by the application's release notes.
* @returns the release notes version
*/
get_release_notes_version(): string;
/**
* Gets the URL of the support page for `self`.
* @returns the support page URL
*/
get_support_url(): string;
/**
* Gets the translator credits string.
* @returns The translator credits string
*/
get_translator_credits(): string;
/**
* Gets the version for `self`.
* @returns the version
*/
get_version(): string;
/**
* Gets the application website URL for `self`.
* @returns the website URL
*/
get_website(): string;
/**
* Sets the name of the application icon for `self`.
*
* The icon is displayed at the top of the main page.
* @param application_icon the application icon name
*/
set_application_icon(application_icon: string): void;
/**
* Sets the application name for `self`.
*
* The name is displayed at the top of the main page.
* @param application_name the application name
*/
set_application_name(application_name: string): void;
/**
* Sets the list of artists of the application.
*
* It will be displayed on the Credits page.
*
* Each name may contain email addresses and URLs, see the introduction for more
* details.
*
* See also:
*
* * [property`AboutDialog:`developers]
* * [property`AboutDialog:`designers]
* * [property`AboutDialog:`documenters]
* * [property`AboutDialog:`translator-credits]
* * [method`AboutDialog`.add_credit_section]
* * [method`AboutDialog`.add_acknowledgement_section]
* @param artists the list of artists
*/
set_artists(artists?: string[] | null): void;
/**
* Sets the comments about the application.
*
* Comments will be shown on the Details page, above links.
*
* Unlike [property`Gtk`.AboutDialog:comments], this string can be long and
* detailed. It can also contain links and Pango markup.
* @param comments the comments
*/
set_comments(comments: string): void;
/**
* Sets the copyright information for `self`.
*
* This should be a short string of one or two lines, for example:
* `© 2022 Example`.
*
* The copyright information will be displayed on the Legal page, before the
* application license.
*
* [method`AboutDialog`.add_legal_section] can be used to add copyright
* information for the application dependencies or other components.
* @param copyright the copyright information
*/
set_copyright(copyright: string): void;
/**
* Sets the debug information for `self`.
*
* Debug information will be shown on the Troubleshooting page. It's intended
* to be attached to issue reports when reporting issues against the
* application.
*
* `AdwAboutDialog` provides a quick way to save debug information to a file.
* When saving, [property`AboutDialog:`debug-info-filename] would be used as
* the suggested filename.
*
* Debug information cannot contain markup or links.
* @param debug_info the debug information
*/
set_debug_info(debug_info: string): void;
/**
* Sets the debug information filename for `self`.
*
* It will be used as the suggested filename when saving debug information to a
* file.
*
* See [property`AboutDialog:`debug-info].
* @param filename the debug info filename
*/
set_debug_info_filename(filename: string): void;
/**
* Sets the list of designers of the application.
*
* It will be displayed on the Credits page.
*
* Each name may contain email addresses and URLs, see the introduction for more
* details.
*
* See also:
*
* * [property`AboutDialog:`developers]
* * [property`AboutDialog:`artists]
* * [property`AboutDialog:`documenters]
* * [property`AboutDialog:`translator-credits]
* * [method`AboutDialog`.add_credit_section]
* * [method`AboutDialog`.add_acknowledgement_section]
* @param designers the list of designers
*/
set_designers(designers?: string[] | null): void;
/**
* Sets the developer name for `self`.
*
* The developer name is displayed on the main page, under the application name.
*
* If the application is developed by multiple people, the developer name can be
* set to values like "AppName team", "AppName developers" or
* "The AppName project", and the individual contributors can be listed on the
* Credits page, with [property`AboutDialog:`developers] and related properties.
* @param developer_name the developer name
*/
set_developer_name(developer_name: string): void;
/**
* Sets the list of developers of the application.
*
* It will be displayed on the Credits page.
*
* Each name may contain email addresses and URLs, see the introduction for more
* details.
*
* See also:
*
* * [property`AboutDialog:`designers]
* * [property`AboutDialog:`artists]
* * [property`AboutDialog:`documenters]
* * [property`AboutDialog:`translator-credits]
* * [method`AboutDialog`.add_credit_section]
* * [method`AboutDialog`.add_acknowledgement_section]
* @param developers the list of developers
*/
set_developers(developers?: string[] | null): void;
/**
* Sets the list of documenters of the application.
*
* It will be displayed on the Credits page.
*
* Each name may contain email addresses and URLs, see the introduction for more
* details.
*
* See also:
*
* * [property`AboutDialog:`developers]
* * [property`AboutDialog:`designers]
* * [property`AboutDialog:`artists]
* * [property`AboutDialog:`translator-credits]
* * [method`AboutDialog`.add_credit_section]
* * [method`AboutDialog`.add_acknowledgement_section]
* @param documenters the list of documenters
*/
set_documenters(documenters?: string[] | null): void;
/**
* Sets the issue tracker URL for `self`.
*
* The issue tracker link is displayed on the main page.
* @param issue_url the issue tracker URL
*/
set_issue_url(issue_url: string): void;
/**
* Sets the license for `self`.
*
* This can be used to set a custom text for the license if it can't be set via
* [property`AboutDialog:`license-type].
*
* When set, [property`AboutDialog:`license-type] will be set to
* `GTK_LICENSE_CUSTOM`.
*
* The license text will be displayed on the Legal page, below the copyright
* information.
*
* License text can contain Pango markup and links.
*
* [method`AboutDialog`.add_legal_section] can be used to add license information
* for the application dependencies or other components.
* @param license the license
*/
set_license(license: string): void;
/**
* Sets the license for `self` from a list of known licenses.
*
* If the application's license is not in the list,
* [property`AboutDialog:`license] can be used instead. The license type will be
* automatically set to `GTK_LICENSE_CUSTOM` in that case.
*
* If `license_type` is `GTK_LICENSE_UNKNOWN`, no information will be displayed.
*
* If `license_type` is different from `GTK_LICENSE_CUSTOM`.
* [property`AboutDialog:`license] will be cleared out.
*
* The license description will be displayed on the Legal page, below the
* copyright information.
*
* [method`AboutDialog`.add_legal_section] can be used to add license information
* for the application dependencies or other components.
* @param license_type the license type
*/
set_license_type(license_type: Gtk.License | null): void;
/**
* Sets the release notes for `self`.
*
* Release notes are displayed on the the What's New page.
*
* Release notes are formatted the same way as
* [AppStream descriptions](https://freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-description).
*
* The supported formatting options are:
*
* * Paragraph (`<p>`)
* * Ordered list (`<ol>`), with list items (`<li>`)
* * Unordered list (`<ul>`), with list items (`<li>`)
*
* Within paragraphs and list items, emphasis (`<em>`) and inline code
* (`<code>`) text styles are supported. The emphasis is rendered in italic,
* while inline code is shown in a monospaced font.
*
* Any text outside paragraphs or list items is ignored.
*
* Nested lists are not supported.
*
* `AdwAboutDialog` displays the version above the release notes. If set, the
* [property`AboutDialog:`release-notes-version] of the property will be used
* as the version; otherwise, [property`AboutDialog:`version] is used.
* @param release_notes the release notes
*/
set_release_notes(release_notes: string): void;
/**
* Sets the version described by the application's release notes.
*
* The release notes version is displayed on the What's New page, above the
* release notes.
*
* If not set, [property`AboutDialog:`version] will be used instead.
*
* For example, an application with the current version 2.0.2 might want to
* keep the release notes from 2.0.0, and set the release notes version
* accordingly.
*
* See [property`AboutDialog:`release-notes].
* @param version the release notes version
*/
set_release_notes_version(version: string): void;
/**
* Sets the URL of the support page for `self`.
*
* The support page link is displayed on the main page.
* @param support_url the support page URL
*/
set_support_url(support_url: string): void;
/**
* Sets the translator credits string.
*
* It will be displayed on the Credits page.
*
* This string should be `"translator-credits"` or `"translator_credits"` and
* should be marked as translatable.
*
* The string may contain email addresses and URLs, see the introduction for
* more details.
*
* See also:
*
* * [property`AboutDialog:`developers]
* * [property`AboutDialog:`designers]
* * [property`AboutDialog:`artists]
* * [property`AboutDialog:`documenters]
* * [method`AboutDialog`.add_credit_section]
* * [method`AboutDialog`.add_acknowledgement_section]
* @param translator_credits the translator credits
*/
set_translator_credits(translator_credits: string): void;
/**
* Sets the version for `self`.
*
* The version is displayed on the main page.
*
* If [property`AboutDialog:`release-notes-version] is not set, the version will
* also be displayed above the release notes on the What's New page.
* @param version the version
*/
set_version(version: string): void;
/**
* Sets the application website URL for `self`.
*
* Website is displayed on the Details page, below comments, or on the main page
* if the Details page doesn't have any other content.
*
* Applications can add other links below, see [method`AboutDialog`.add_link].
* @param website the website URL
*/
set_website(website: string): void;
// Inherited methods
/**
* Add a `GtkShortcutController` to be managed.
* @param controller
*/
vfunc_add_controller(controller: Gtk.ShortcutController): void;
/**
* Remove a `GtkShortcutController` that had previously
* been added
* @param controller
*/
vfunc_remove_controller(controller: Gtk.ShortcutController): 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 AboutWindow {
// Signal callback interfaces
interface ActivateLink {
(uri: string): boolean;
}
// Constructor properties interface
interface ConstructorProps
extends Window.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Native.ConstructorProps,
Gtk.Root.ConstructorProps,
Gtk.ShortcutManager.ConstructorProps {
application_icon: string;
applicationIcon: string;
application_name: string;
applicationName: string;
artists: string[];
comments: string;
copyright: string;
debug_info: string;
debugInfo: string;
debug_info_filename: string;
debugInfoFilename: string;
designers: string[];
developer_name: string;
developerName: string;
developers: string[];
documenters: string[];
issue_url: string;
issueUrl: string;
license: string;
license_type: Gtk.License;
licenseType: Gtk.License;
release_notes: string;
releaseNotes: string;
release_notes_version: string;
releaseNotesVersion: string;
support_url: string;
supportUrl: string;
translator_credits: string;
translatorCredits: string;
version: string;
website: string;
}
}
/**
* A window showing information about the application.
*
* <picture>
* <source srcset="about-window-dark.png" media="(prefers-color-scheme: dark)">
* <img src="about-window.png" alt="about-window">
* </picture>
*
* An about window is typically opened when the user activates the `About …`
* item in the application's primary menu. All parts of the window are optional.
*
* ## Main page
*
* `AdwAboutWindow` prominently displays the application's icon, name, developer
* name and version. They can be set with the [property`AboutWindow:`application-icon],
* [property`AboutWindow:`application-name],
* [property`AboutWindow:`developer-name] and [property`AboutWindow:`version]
* respectively.
*
* ## What's New
*
* `AdwAboutWindow` provides a way for applications to display their release
* notes, set with the [property`AboutWindow:`release-notes] property.
*
* Release notes are formatted the same way as
* [AppStream descriptions](https://freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-description).
*
* The supported formatting options are:
*
* * Paragraph (`<p>`)
* * Ordered list (`<ol>`), with list items (`<li>`)
* * Unordered list (`<ul>`), with list items (`<li>`)
*
* Within paragraphs and list items, emphasis (`<em>`) and inline code
* (`<code>`) text styles are supported. The emphasis is rendered in italic,
* while inline code is shown in a monospaced font.
*
* Any text outside paragraphs or list items is ignored.
*
* Nested lists are not supported.
*
* Only one version can be shown at a time. By default, the displayed version
* number matches [property`AboutWindow:`version]. Use
* [property`AboutWindow:`release-notes-version] to override it.
*
* ## Details
*
* The Details page displays the application comments and links.
*
* The comments can be set with the [property`AboutWindow:`comments] property.
* Unlike [property`Gtk`.AboutDialog:comments], this string can be long and
* detailed. It can also contain links and Pango markup.
*
* To set the application website, use [property`AboutWindow:`website].
* To add extra links below the website, use [method`AboutWindow`.add_link].
*
* If the Details page doesn't have any other content besides website, the
* website will be displayed on the main page instead.
*
* ## Troubleshooting
*
* `AdwAboutWindow` displays the following two links on the main page:
*
* * Support Questions, set with the [property`AboutWindow:`support-url] property,
* * Report an Issue, set with the [property`AboutWindow:`issue-url] property.
*
* Additionally, applications can provide debugging information. It will be
* shown separately on the Troubleshooting page. Use the
* [property`AboutWindow:`debug-info] property to specify it.
*
* It's intended to be attached to issue reports when reporting issues against
* the application. As such, it cannot contain markup or links.
*
* `AdwAboutWindow` provides a quick way to save debug information to a file.
* When saving, [property`AboutWindow:`debug-info-filename] would be used as
* the suggested filename.
*
* ## Credits and Acknowledgements
*
* The Credits page has the following default sections:
*
* * Developers, set with the [property`AboutWindow:`developers] property,
* * Designers, set with the [property`AboutWindow:`designers] property,
* * Artists, set with the [property`AboutWindow:`artists] property,
* * Documenters, set with the [property`AboutWindow:`documenters] property,
* * Translators, set with the [property`AboutWindow:`translator-credits] property.
*
* When setting translator credits, use the strings `"translator-credits"` or
* `"translator_credits"` and mark them as translatable.
*
* The default sections that don't contain any names won't be displayed.
*
* The Credits page can also contain an arbitrary number of extra sections below
* the default ones. Use [method`AboutWindow`.add_credit_section] to add them.
*
* The Acknowledgements page can be used to acknowledge additional people and
* organizations for their non-development contributions. Use
* [method`AboutWindow`.add_acknowledgement_section] to add sections to it. For
* example, it can be used to list backers in a crowdfunded project or to give
* special thanks.
*
* Each of the people or organizations can have an email address or a website
* specified. To add a email address, use a string like
* `Edgar Allan Poe <edgar`poe`.com>`. To specify a website with a title, use a
* string like `The GNOME Project https://www.gnome.org`:
*
* <picture>
* <source srcset="about-window-credits-dark.png" media="(prefers-color-scheme: dark)">
* <img src="about-window-credits.png" alt="about-window-credits">
* </picture>
*
* ## Legal
*
* The Legal page displays the copyright and licensing information for the
* application and other modules.
*
* The copyright string is set with the [property`AboutWindow:`copyright]
* property and should be a short string of one or two lines, for example:
* `© 2022 Example`.
*
* Licensing information can be quickly set from a list of known licenses with
* the [property`AboutWindow:`license-type] property. If the application's
* license is not in the list, [property`AboutWindow:`license] can be used
* instead.
*
* To add information about other modules, such as application dependencies or
* data, use [method`AboutWindow`.add_legal_section].
*
* ## Constructing
*
* To make constructing an `AdwAboutWindow` as convenient as possible, you can
* use the function [func`show_about_window]` which constructs and shows a
* window.
*
* ```c
* static void
* show_about (GtkApplication *app)
* {
* const char *developers[] = {
* "Angela Avery",
* NULL
* };
*
* const char *designers[] = {
* "GNOME Design Team",
* NULL
* };
*
* adw_show_about_window (gtk_application_get_active_window (app),
* "application-name", _("Example"),
* "application-icon", "org.example.App",
* "version", "1.2.3",
* "copyright", "© 2022 Angela Avery",
* "issue-url", "https://gitlab.gnome.org/example/example/-/issues/",
* "license-type", GTK_LICENSE_GPL_3_0,
* "developers", developers,
* "designers", designers,
* "translator-credits", _("translator-credits"),
* NULL);
* }
* ```
*
* ## CSS nodes
*
* `AdwAboutWindow` has a main CSS node with the name `window` and the
* style class `.about`.
*/
class AboutWindow
extends Window
implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Native, Gtk.Root, Gtk.ShortcutManager
{
static $gtype: GObject.GType<AboutWindow>;
// Properties
/**
* The name of the application icon.
*
* The icon is displayed at the top of the main page.
*/
get application_icon(): string;
set application_icon(val: string);
/**
* The name of the application icon.
*
* The icon is displayed at the top of the main page.
*/
get applicationIcon(): string;
set applicationIcon(val: string);
/**
* The name of the application.
*
* The name is displayed at the top of the main page.
*/
get application_name(): string;
set application_name(val: string);
/**
* The name of the application.
*
* The name is displayed at the top of the main page.
*/
get applicationName(): string;
set applicationName(val: string);
/**
* The list of artists of the application.
*
* It will be displayed on the Credits page.
*
* Each name may contain email addresses and URLs, see the introduction for
* more details.
*
* See also:
*
* * [property`AboutWindow:`developers]
* * [property`AboutWindow:`designers]
* * [property`AboutWindow:`documenters]
* * [property`AboutWindow:`translator-credits]
* * [method`AboutWindow`.add_credit_section]
* * [method`AboutWindow`.add_acknowledgement_section]
*/
get artists(): string[];
set artists(val: string[]);
/**
* The comments about the application.
*
* Comments will be shown on the Details page, above links.
*
* Unlike [property`Gtk`.AboutDialog:comments], this string can be long and
* detailed. It can also contain links and Pango markup.
*/
get comments(): string;
set comments(val: string);
/**
* The copyright information.
*
* This should be a short string of one or two lines, for example:
* `© 2022 Example`.
*
* The copyright information will be displayed on the Legal page, above the
* application license.
*
* [method`AboutWindow`.add_legal_section] can be used to add copyright
* information for the application dependencies or other components.
*/
get copyright(): string;
set copyright(val: string);
/**
* The debug information.
*
* Debug information will be shown on the Troubleshooting page. It's intended
* to be attached to issue reports when reporting issues against the
* application.
*
* `AdwAboutWindow` provides a quick way to save debug information to a file.
* When saving, [property`AboutWindow:`debug-info-filename] would be used as
* the suggested filename.
*
* Debug information cannot contain markup or links.
*/
get debug_info(): string;
set debug_info(val: string);
/**
* The debug information.
*
* Debug information will be shown on the Troubleshooting page. It's intended
* to be attached to issue reports when reporting issues against the
* application.
*
* `AdwAboutWindow` provides a quick way to save debug information to a file.
* When saving, [property`AboutWindow:`debug-info-filename] would be used as
* the suggested filename.
*
* Debug information cannot contain markup or links.
*/
get debugInfo(): string;
set debugInfo(val: string);
/**
* The debug information filename.
*
* It will be used as the suggested filename when saving debug information to
* a file.
*
* See [property`AboutWindow:`debug-info].
*/
get debug_info_filename(): string;
set debug_info_filename(val: string);
/**
* The debug information filename.
*
* It will be used as the suggested filename when saving debug information to
* a file.
*
* See [property`AboutWindow:`debug-info].
*/
get debugInfoFilename(): string;
set debugInfoFilename(val: string);
/**
* The list of designers of the application.
*
* It will be displayed on the Credits page.
*
* Each name may contain email addresses and URLs, see the introduction for
* more details.
*
* See also:
*
* * [property`AboutWindow:`developers]
* * [property`AboutWindow:`artists]
* * [property`AboutWindow:`documenters]
* * [property`AboutWindow:`translator-credits]
* * [method`AboutWindow`.add_credit_section]
* * [method`AboutWindow`.add_acknowledgement_section]
*/
get designers(): string[];
set designers(val: string[]);
/**
* The developer name.
*
* The developer name is displayed on the main page, under the application
* name.
*
* If the application is developed by multiple people, the developer name can
* be set to values like "AppName team", "AppName developers" or
* "The AppName project", and the individual contributors can be listed on the
* Credits page, with [property`AboutWindow:`developers] and related
* properties.
*/
get developer_name(): string;
set developer_name(val: string);
/**
* The developer name.
*
* The developer name is displayed on the main page, under the application
* name.
*
* If the application is developed by multiple people, the developer name can
* be set to values like "AppName team", "AppName developers" or
* "The AppName project", and the individual contributors can be listed on the
* Credits page, with [property`AboutWindow:`developers] and related
* properties.
*/
get developerName(): string;
set developerName(val: string);
/**
* The list of developers of the application.
*
* It will be displayed on the Credits page.
*
* Each name may contain email addresses and URLs, see the introduction for
* more details.
*
* See also:
*
* * [property`AboutWindow:`designers]
* * [property`AboutWindow:`artists]
* * [property`AboutWindow:`documenters]
* * [property`AboutWindow:`translator-credits]
* * [method`AboutWindow`.add_credit_section]
* * [method`AboutWindow`.add_acknowledgement_section]
*/
get developers(): string[];
set developers(val: string[]);
/**
* The list of documenters of the application.
*
* It will be displayed on the Credits page.
*
* Each name may contain email addresses and URLs, see the introduction for
* more details.
*
* See also:
*
* * [property`AboutWindow:`developers]
* * [property`AboutWindow:`designers]
* * [property`AboutWindow:`artists]
* * [property`AboutWindow:`translator-credits]
* * [method`AboutWindow`.add_credit_section]
* * [method`AboutWindow`.add_acknowledgement_section]
*/
get documenters(): string[];
set documenters(val: string[]);
/**
* The URL for the application's issue tracker.
*
* The issue tracker link is displayed on the main page.
*/
get issue_url(): string;
set issue_url(val: string);
/**
* The URL for the application's issue tracker.
*
* The issue tracker link is displayed on the main page.
*/
get issueUrl(): string;
set issueUrl(val: string);
/**
* The license text.
*
* This can be used to set a custom text for the license if it can't be set
* via [property`AboutWindow:`license-type].
*
* When set, [property`AboutWindow:`license-type] will be set to
* `GTK_LICENSE_CUSTOM`.
*
* The license text will be displayed on the Legal page, below the copyright
* information.
*
* License text can contain Pango markup and links.
*
* [method`AboutWindow`.add_legal_section] can be used to add license
* information for the application dependencies or other components.
*/
get license(): string;
set license(val: string);
/**
* The license type.
*
* Allows to set the application's license froma list of known licenses.
*
* If the application's license is not in the list,
* [property`AboutWindow:`license] can be used instead. The license type will
* be automatically set to `GTK_LICENSE_CUSTOM` in that case.
*
* If set to `GTK_LICENSE_UNKNOWN`, no information will be displayed.
*
* If the license type is different from `GTK_LICENSE_CUSTOM`.
* [property`AboutWindow:`license] will be cleared out.
*
* The license description will be displayed on the Legal page, below the
* copyright information.
*
* [method`AboutWindow`.add_legal_section] can be used to add license
* information for the application dependencies or other components.
*/
get license_type(): Gtk.License;
set license_type(val: Gtk.License);
/**
* The license type.
*
* Allows to set the application's license froma list of known licenses.
*
* If the application's license is not in the list,
* [property`AboutWindow:`license] can be used instead. The license type will
* be automatically set to `GTK_LICENSE_CUSTOM` in that case.
*
* If set to `GTK_LICENSE_UNKNOWN`, no information will be displayed.
*
* If the license type is different from `GTK_LICENSE_CUSTOM`.
* [property`AboutWindow:`license] will be cleared out.
*
* The license description will be displayed on the Legal page, below the
* copyright information.
*
* [method`AboutWindow`.add_legal_section] can be used to add license
* information for the application dependencies or other components.
*/
get licenseType(): Gtk.License;
set licenseType(val: Gtk.License);
/**
* The release notes of the application.
*
* Release notes are displayed on the the What's New page.
*
* Release notes are formatted the same way as
* [AppStream descriptions](https://freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-description).
*
* The supported formatting options are:
*
* * Paragraph (`<p>`)
* * Ordered list (`<ol>`), with list items (`<li>`)
* * Unordered list (`<ul>`), with list items (`<li>`)
*
* Within paragraphs and list items, emphasis (`<em>`) and inline code
* (`<code>`) text styles are supported. The emphasis is rendered in italic,
* while inline code is shown in a monospaced font.
*
* Any text outside paragraphs or list items is ignored.
*
* Nested lists are not supported.
*
* `AdwAboutWindow` displays the version above the release notes. If set, the
* [property`AboutWindow:`release-notes-version] of the property will be used
* as the version; otherwise, [property`AboutWindow:`version] is used.
*/
get release_notes(): string;
set release_notes(val: string);
/**
* The release notes of the application.
*
* Release notes are displayed on the the What's New page.
*
* Release notes are formatted the same way as
* [AppStream descriptions](https://freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-description).
*
* The supported formatting options are:
*
* * Paragraph (`<p>`)
* * Ordered list (`<ol>`), with list items (`<li>`)
* * Unordered list (`<ul>`), with list items (`<li>`)
*
* Within paragraphs and list items, emphasis (`<em>`) and inline code
* (`<code>`) text styles are supported. The emphasis is rendered in italic,
* while inline code is shown in a monospaced font.
*
* Any text outside paragraphs or list items is ignored.
*
* Nested lists are not supported.
*
* `AdwAboutWindow` displays the version above the release notes. If set, the
* [property`AboutWindow:`release-notes-version] of the property will be used
* as the version; otherwise, [property`AboutWindow:`version] is used.
*/
get releaseNotes(): string;
set releaseNotes(val: string);
/**
* The version described by the application's release notes.
*
* The release notes version is displayed on the What's New page, above the
* release notes.
*
* If not set, [property`AboutWindow:`version] will be used instead.
*
* For example, an application with the current version 2.0.2 might want to
* keep the release notes from 2.0.0, and set the release notes version
* accordingly.
*
* See [property`AboutWindow:`release-notes].
*/
get release_notes_version(): string;
set release_notes_version(val: string);
/**
* The version described by the application's release notes.
*
* The release notes version is displayed on the What's New page, above the
* release notes.
*
* If not set, [property`AboutWindow:`version] will be used instead.
*
* For example, an application with the current version 2.0.2 might want to
* keep the release notes from 2.0.0, and set the release notes version
* accordingly.
*
* See [property`AboutWindow:`release-notes].
*/
get releaseNotesVersion(): string;
set releaseNotesVersion(val: string);
/**
* The URL of the application's support page.
*
* The support page link is displayed on the main page.
*/
get support_url(): string;
set support_url(val: string);
/**
* The URL of the application's support page.
*
* The support page link is displayed on the main page.
*/
get supportUrl(): string;
set supportUrl(val: string);
/**
* The translator credits string.
*
* It will be displayed on the Credits page.
*
* This string should be `"translator-credits"` or `"translator_credits"` and
* should be marked as translatable.
*
* The string may contain email addresses and URLs, see the introduction for
* more details.
*
* See also:
*
* * [property`AboutWindow:`developers]
* * [property`AboutWindow:`designers]
* * [property`AboutWindow:`artists]
* * [property`AboutWindow:`documenters]
* * [method`AboutWindow`.add_credit_section]
* * [method`AboutWindow`.add_acknowledgement_section]
*/
get translator_credits(): string;
set translator_credits(val: string);
/**
* The translator credits string.
*
* It will be displayed on the Credits page.
*
* This string should be `"translator-credits"` or `"translator_credits"` and
* should be marked as translatable.
*
* The string may contain email addresses and URLs, see the introduction for
* more details.
*
* See also:
*
* * [property`AboutWindow:`developers]
* * [property`AboutWindow:`designers]
* * [property`AboutWindow:`artists]
* * [property`AboutWindow:`documenters]
* * [method`AboutWindow`.add_credit_section]
* * [method`AboutWindow`.add_acknowledgement_section]
*/
get translatorCredits(): string;
set translatorCredits(val: string);
/**
* The version of the application.
*
* The version is displayed on the main page.
*
* If [property`AboutWindow:`release-notes-version] is not set, the version
* will also be displayed above the release notes on the What's New page.
*/
get version(): string;
set version(val: string);
/**
* The URL of the application's website.
*
* Website is displayed on the Details page, below comments, or on the main
* page if the Details page doesn't have any other content.
*
* Applications can add other links below, see [method`AboutWindow`.add_link].
*/
get website(): string;
set website(val: string);
// Constructors
constructor(properties?: Partial<AboutWindow.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): AboutWindow;
static new_from_appdata(resource_path: string, release_notes_version?: string | null): AboutWindow;
// 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-link', callback: (_source: this, uri: string) => boolean): number;
connect_after(signal: 'activate-link', callback: (_source: this, uri: string) => boolean): number;
emit(signal: 'activate-link', uri: string): void;
// Methods
/**
* Adds a section to the Acknowledgements page.
*
* This can be used to acknowledge additional people and organizations for their
* non-development contributions - for example, backers in a crowdfunded
* project.
*
* Each name may contain email addresses and URLs, see the introduction for more
* details.
*
* See also:
*
* * [property`AboutWindow:`developers]
* * [property`AboutWindow:`designers]
* * [property`AboutWindow:`artists]
* * [property`AboutWindow:`documenters]
* * [property`AboutWindow:`translator-credits]
* * [method`AboutWindow`.add_credit_section]
* @param name the section name
* @param people the list of names
*/
add_acknowledgement_section(name: string | null, people: string[]): void;
/**
* Adds an extra section to the Credits page.
*
* Extra sections are displayed below the standard categories.
*
* Each name may contain email addresses and URLs, see the introduction for more
* details.
*
* See also:
*
* * [property`AboutWindow:`developers]
* * [property`AboutWindow:`designers]
* * [property`AboutWindow:`artists]
* * [property`AboutWindow:`documenters]
* * [property`AboutWindow:`translator-credits]
* * [method`AboutWindow`.add_acknowledgement_section]
* @param name the section name
* @param people the list of names
*/
add_credit_section(name: string | null, people: string[]): void;
/**
* Adds an extra section to the Legal page.
*
* Extra sections will be displayed below the application's own information.
*
* The parameters `copyright,` `license_type` and `license` will be used to present
* the it the same way as [property`AboutWindow:`copyright],
* [property`AboutWindow:`license-type] and [property`AboutWindow:`license] are
* for the application's own information.
*
* See those properties for more details.
*
* This can be useful to attribute the application dependencies or data.
*
* Examples:
*
* ```c
* adw_about_window_add_legal_section (ADW_ABOUT_WINDOW (about),
* _("Copyright and a known license"),
* "© 2022 Example",
* GTK_LICENSE_LGPL_2_1,
* NULL);
*
* adw_about_window_add_legal_section (ADW_ABOUT_WINDOW (about),
* _("Copyright and custom license"),
* "© 2022 Example",
* GTK_LICENSE_CUSTOM,
* "Custom license text");
*
* adw_about_window_add_legal_section (ADW_ABOUT_WINDOW (about),
* _("Copyright only"),
* "© 2022 Example",
* GTK_LICENSE_UNKNOWN,
* NULL);
*
* adw_about_window_add_legal_section (ADW_ABOUT_WINDOW (about),
* _("Custom license only"),
* NULL,
* GTK_LICENSE_CUSTOM,
* "Something completely custom here.");
* ```
* @param title the name of the section
* @param copyright a copyright string
* @param license_type the type of license
* @param license custom license information
*/
add_legal_section(
title: string,
copyright: string | null,
license_type: Gtk.License | null,
license?: string | null,
): void;
/**
* Adds an extra link to the Details page.
*
* Extra links are displayed under the comment and website.
*
* Underlines in `title` will be interpreted as indicating a mnemonic.
*
* See [property`AboutWindow:`website].
* @param title the link title
* @param url the link URL
*/
add_link(title: string, url: string): void;
/**
* Gets the name of the application icon for `self`.
* @returns the application icon name
*/
get_application_icon(): string;
/**
* Gets the application name for `self`.
* @returns the application name
*/
get_application_name(): string;
/**
* Gets the list of artists of the application.
* @returns The list of artists
*/
get_artists(): string[] | null;
/**
* Gets the comments about the application.
* @returns the comments
*/
get_comments(): string;
/**
* Gets the copyright information for `self`.
* @returns the copyright information
*/
get_copyright(): string;
/**
* Gets the debug information for `self`.
* @returns the debug information
*/
get_debug_info(): string;
/**
* Gets the debug information filename for `self`.
* @returns the debug information filename
*/
get_debug_info_filename(): string;
/**
* Gets the list of designers of the application.
* @returns The list of designers
*/
get_designers(): string[] | null;
/**
* Gets the developer name for `self`.
* @returns the developer_name
*/
get_developer_name(): string;
/**
* Gets the list of developers of the application.
* @returns The list of developers
*/
get_developers(): string[] | null;
/**
* Gets the list of documenters of the application.
* @returns The list of documenters
*/
get_documenters(): string[] | null;
/**
* Gets the issue tracker URL for `self`.
* @returns the issue tracker URL
*/
get_issue_url(): string;
/**
* Gets the license for `self`.
* @returns the license
*/
get_license(): string;
/**
* Gets the license type for `self`.
* @returns the license type
*/
get_license_type(): Gtk.License;
/**
* Gets the release notes for `self`.
* @returns the release notes
*/
get_release_notes(): string;
/**
* Gets the version described by the application's release notes.
* @returns the release notes version
*/
get_release_notes_version(): string;
/**
* Gets the URL of the support page for `self`.
* @returns the support page URL
*/
get_support_url(): string;
/**
* Gets the translator credits string.
* @returns The translator credits string
*/
get_translator_credits(): string;
/**
* Gets the version for `self`.
* @returns the version
*/
get_version(): string;
/**
* Gets the application website URL for `self`.
* @returns the website URL
*/
get_website(): string;
/**
* Sets the name of the application icon for `self`.
*
* The icon is displayed at the top of the main page.
* @param application_icon the application icon name
*/
set_application_icon(application_icon: string): void;
/**
* Sets the application name for `self`.
*
* The name is displayed at the top of the main page.
* @param application_name the application name
*/
set_application_name(application_name: string): void;
/**
* Sets the list of artists of the application.
*
* It will be displayed on the Credits page.
*
* Each name may contain email addresses and URLs, see the introduction for more
* details.
*
* See also:
*
* * [property`AboutWindow:`developers]
* * [property`AboutWindow:`designers]
* * [property`AboutWindow:`documenters]
* * [property`AboutWindow:`translator-credits]
* * [method`AboutWindow`.add_credit_section]
* * [method`AboutWindow`.add_acknowledgement_section]
* @param artists the list of artists
*/
set_artists(artists?: string[] | null): void;
/**
* Sets the comments about the application.
*
* Comments will be shown on the Details page, above links.
*
* Unlike [property`Gtk`.AboutDialog:comments], this string can be long and
* detailed. It can also contain links and Pango markup.
* @param comments the comments
*/
set_comments(comments: string): void;
/**
* Sets the copyright information for `self`.
*
* This should be a short string of one or two lines, for example:
* `© 2022 Example`.
*
* The copyright information will be displayed on the Legal page, before the
* application license.
*
* [method`AboutWindow`.add_legal_section] can be used to add copyright
* information for the application dependencies or other components.
* @param copyright the copyright information
*/
set_copyright(copyright: string): void;
/**
* Sets the debug information for `self`.
*
* Debug information will be shown on the Troubleshooting page. It's intended
* to be attached to issue reports when reporting issues against the
* application.
*
* `AdwAboutWindow` provides a quick way to save debug information to a file.
* When saving, [property`AboutWindow:`debug-info-filename] would be used as
* the suggested filename.
*
* Debug information cannot contain markup or links.
* @param debug_info the debug information
*/
set_debug_info(debug_info: string): void;
/**
* Sets the debug information filename for `self`.
*
* It will be used as the suggested filename when saving debug information to a
* file.
*
* See [property`AboutWindow:`debug-info].
* @param filename the debug info filename
*/
set_debug_info_filename(filename: string): void;
/**
* Sets the list of designers of the application.
*
* It will be displayed on the Credits page.
*
* Each name may contain email addresses and URLs, see the introduction for more
* details.
*
* See also:
*
* * [property`AboutWindow:`developers]
* * [property`AboutWindow:`artists]
* * [property`AboutWindow:`documenters]
* * [property`AboutWindow:`translator-credits]
* * [method`AboutWindow`.add_credit_section]
* * [method`AboutWindow`.add_acknowledgement_section]
* @param designers the list of designers
*/
set_designers(designers?: string[] | null): void;
/**
* Sets the developer name for `self`.
*
* The developer name is displayed on the main page, under the application name.
*
* If the application is developed by multiple people, the developer name can be
* set to values like "AppName team", "AppName developers" or
* "The AppName project", and the individual contributors can be listed on the
* Credits page, with [property`AboutWindow:`developers] and related properties.
* @param developer_name the developer name
*/
set_developer_name(developer_name: string): void;
/**
* Sets the list of developers of the application.
*
* It will be displayed on the Credits page.
*
* Each name may contain email addresses and URLs, see the introduction for more
* details.
*
* See also:
*
* * [property`AboutWindow:`designers]
* * [property`AboutWindow:`artists]
* * [property`AboutWindow:`documenters]
* * [property`AboutWindow:`translator-credits]
* * [method`AboutWindow`.add_credit_section]
* * [method`AboutWindow`.add_acknowledgement_section]
* @param developers the list of developers
*/
set_developers(developers?: string[] | null): void;
/**
* Sets the list of documenters of the application.
*
* It will be displayed on the Credits page.
*
* Each name may contain email addresses and URLs, see the introduction for more
* details.
*
* See also:
*
* * [property`AboutWindow:`developers]
* * [property`AboutWindow:`designers]
* * [property`AboutWindow:`artists]
* * [property`AboutWindow:`translator-credits]
* * [method`AboutWindow`.add_credit_section]
* * [method`AboutWindow`.add_acknowledgement_section]
* @param documenters the list of documenters
*/
set_documenters(documenters?: string[] | null): void;
/**
* Sets the issue tracker URL for `self`.
*
* The issue tracker link is displayed on the main page.
* @param issue_url the issue tracker URL
*/
set_issue_url(issue_url: string): void;
/**
* Sets the license for `self`.
*
* This can be used to set a custom text for the license if it can't be set via
* [property`AboutWindow:`license-type].
*
* When set, [property`AboutWindow:`license-type] will be set to
* `GTK_LICENSE_CUSTOM`.
*
* The license text will be displayed on the Legal page, below the copyright
* information.
*
* License text can contain Pango markup and links.
*
* [method`AboutWindow`.add_legal_section] can be used to add license information
* for the application dependencies or other components.
* @param license the license
*/
set_license(license: string): void;
/**
* Sets the license for `self` from a list of known licenses.
*
* If the application's license is not in the list,
* [property`AboutWindow:`license] can be used instead. The license type will be
* automatically set to `GTK_LICENSE_CUSTOM` in that case.
*
* If `license_type` is `GTK_LICENSE_UNKNOWN`, no information will be displayed.
*
* If `license_type` is different from `GTK_LICENSE_CUSTOM`.
* [property`AboutWindow:`license] will be cleared out.
*
* The license description will be displayed on the Legal page, below the
* copyright information.
*
* [method`AboutWindow`.add_legal_section] can be used to add license information
* for the application dependencies or other components.
* @param license_type the license type
*/
set_license_type(license_type: Gtk.License | null): void;
/**
* Sets the release notes for `self`.
*
* Release notes are displayed on the the What's New page.
*
* Release notes are formatted the same way as
* [AppStream descriptions](https://freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-description).
*
* The supported formatting options are:
*
* * Paragraph (`<p>`)
* * Ordered list (`<ol>`), with list items (`<li>`)
* * Unordered list (`<ul>`), with list items (`<li>`)
*
* Within paragraphs and list items, emphasis (`<em>`) and inline code
* (`<code>`) text styles are supported. The emphasis is rendered in italic,
* while inline code is shown in a monospaced font.
*
* Any text outside paragraphs or list items is ignored.
*
* Nested lists are not supported.
*
* `AdwAboutWindow` displays the version above the release notes. If set, the
* [property`AboutWindow:`release-notes-version] of the property will be used
* as the version; otherwise, [property`AboutWindow:`version] is used.
* @param release_notes the release notes
*/
set_release_notes(release_notes: string): void;
/**
* Sets the version described by the application's release notes.
*
* The release notes version is displayed on the What's New page, above the
* release notes.
*
* If not set, [property`AboutWindow:`version] will be used instead.
*
* For example, an application with the current version 2.0.2 might want to
* keep the release notes from 2.0.0, and set the release notes version
* accordingly.
*
* See [property`AboutWindow:`release-notes].
* @param version the release notes version
*/
set_release_notes_version(version: string): void;
/**
* Sets the URL of the support page for `self`.
*
* The support page link is displayed on the main page.
* @param support_url the support page URL
*/
set_support_url(support_url: string): void;
/**
* Sets the translator credits string.
*
* It will be displayed on the Credits page.
*
* This string should be `"translator-credits"` or `"translator_credits"` and
* should be marked as translatable.
*
* The string may contain email addresses and URLs, see the introduction for
* more details.
*
* See also:
*
* * [property`AboutWindow:`developers]
* * [property`AboutWindow:`designers]
* * [property`AboutWindow:`artists]
* * [property`AboutWindow:`documenters]
* * [method`AboutWindow`.add_credit_section]
* * [method`AboutWindow`.add_acknowledgement_section]
* @param translator_credits the translator credits
*/
set_translator_credits(translator_credits: string): void;
/**
* Sets the version for `self`.
*
* The version is displayed on the main page.
*
* If [property`AboutWindow:`release-notes-version] is not set, the version will
* also be displayed above the release notes on the What's New page.
* @param version the version
*/
set_version(version: string): void;
/**
* Sets the application website URL for `self`.
*
* Website is displayed on the Details page, below comments, or on the main page
* if the Details page doesn't have any other content.
*
* Applications can add other links below, see [method`AboutWindow`.add_link].
* @param website the website URL
*/
set_website(website: string): void;
// Inherited properties
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// 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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace ActionRow {
// Signal callback interfaces
interface Activated {
(): void;
}
// Constructor properties interface
interface ConstructorProps
extends PreferencesRow.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Actionable.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
activatable_widget: Gtk.Widget;
activatableWidget: Gtk.Widget;
icon_name: string;
iconName: string;
subtitle: string;
subtitle_lines: number;
subtitleLines: number;
subtitle_selectable: boolean;
subtitleSelectable: boolean;
title_lines: number;
titleLines: number;
}
}
/**
* A [class`Gtk`.ListBoxRow] used to present actions.
*
* <picture>
* <source srcset="action-row-dark.png" media="(prefers-color-scheme: dark)">
* <img src="action-row.png" alt="action-row">
* </picture>
*
* The `AdwActionRow` widget can have a title, a subtitle and an icon. The row
* can receive additional widgets at its end, or prefix widgets at its start.
*
* It is convenient to present a preference and its related actions.
*
* `AdwActionRow` is unactivatable by default, giving it an activatable widget
* will automatically make it activatable, but unsetting it won't change the
* row's activatability.
*
* ## AdwActionRow as GtkBuildable
*
* The `AdwActionRow` implementation of the [iface`Gtk`.Buildable] interface
* supports adding a child at its end by specifying “suffix” or omitting the
* “type” attribute of a <child> element.
*
* It also supports adding a child as a prefix widget by specifying “prefix” as
* the “type” attribute of a <child> element.
*
* ## CSS nodes
*
* `AdwActionRow` has a main CSS node with name `row`.
*
* It contains the subnode `box.header` for its main horizontal box, and
* `box.title` for the vertical box containing the title and subtitle labels.
*
* It contains subnodes `label.title` and `label.subtitle` representing
* respectively the title label and subtitle label.
*
* ## Style classes
*
* `AdwActionRow` can use the [`.property`](style-classes.html#property-rows)
* style class to emphasize the row subtitle instead of the row title, which is
* useful for displaying read-only properties.
*
* <picture>
* <source srcset="property-row-dark.png" media="(prefers-color-scheme: dark)">
* <img src="property-row.png" alt="property-row">
* </picture>
*
* When used together with the `.monospace` style class, only the subtitle
* becomes monospace, not the title or any extra widgets.
*/
class ActionRow
extends PreferencesRow
implements Gtk.Accessible, Gtk.Actionable, Gtk.Buildable, Gtk.ConstraintTarget
{
static $gtype: GObject.GType<ActionRow>;
// Properties
/**
* The widget to activate when the row is activated.
*
* The row can be activated either by clicking on it, calling
* [method`ActionRow`.activate], or via mnemonics in the title.
* See the [property`PreferencesRow:`use-underline] property to enable
* mnemonics.
*
* The target widget will be activated by emitting the
* [signal`Gtk`.Widget::mnemonic-activate] signal on it.
*/
get activatable_widget(): Gtk.Widget;
set activatable_widget(val: Gtk.Widget);
/**
* The widget to activate when the row is activated.
*
* The row can be activated either by clicking on it, calling
* [method`ActionRow`.activate], or via mnemonics in the title.
* See the [property`PreferencesRow:`use-underline] property to enable
* mnemonics.
*
* The target widget will be activated by emitting the
* [signal`Gtk`.Widget::mnemonic-activate] signal on it.
*/
get activatableWidget(): Gtk.Widget;
set activatableWidget(val: Gtk.Widget);
/**
* The icon name for this row.
*/
get icon_name(): string;
set icon_name(val: string);
/**
* The icon name for this row.
*/
get iconName(): string;
set iconName(val: string);
/**
* The subtitle for this row.
*
* The subtitle is interpreted as Pango markup unless
* [property`PreferencesRow:`use-markup] is set to `FALSE`.
*/
get subtitle(): string;
set subtitle(val: string);
/**
* The number of lines at the end of which the subtitle label will be
* ellipsized.
*
* If the value is 0, the number of lines won't be limited.
*/
get subtitle_lines(): number;
set subtitle_lines(val: number);
/**
* The number of lines at the end of which the subtitle label will be
* ellipsized.
*
* If the value is 0, the number of lines won't be limited.
*/
get subtitleLines(): number;
set subtitleLines(val: number);
/**
* Whether the user can copy the subtitle from the label.
*
* See also [property`Gtk`.Label:selectable].
*/
get subtitle_selectable(): boolean;
set subtitle_selectable(val: boolean);
/**
* Whether the user can copy the subtitle from the label.
*
* See also [property`Gtk`.Label:selectable].
*/
get subtitleSelectable(): boolean;
set subtitleSelectable(val: boolean);
/**
* The number of lines at the end of which the title label will be ellipsized.
*
* If the value is 0, the number of lines won't be limited.
*/
get title_lines(): number;
set title_lines(val: number);
/**
* The number of lines at the end of which the title label will be ellipsized.
*
* If the value is 0, the number of lines won't be limited.
*/
get titleLines(): number;
set titleLines(val: number);
// Constructors
constructor(properties?: Partial<ActionRow.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): ActionRow;
// 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: 'activated', callback: (_source: this) => void): number;
connect_after(signal: 'activated', callback: (_source: this) => void): number;
emit(signal: 'activated'): void;
// Virtual methods
/**
* Activates `self`.
*/
vfunc_activate(): void;
// Methods
/**
* Activates `self`.
*/
activate(): void;
// Conflicted with Gtk.Widget.activate
activate(...args: never[]): any;
/**
* Adds a prefix widget to `self`.
* @param widget a widget
*/
add_prefix(widget: Gtk.Widget): void;
/**
* Adds a suffix widget to `self`.
* @param widget a widget
*/
add_suffix(widget: Gtk.Widget): void;
/**
* Gets the widget activated when `self` is activated.
* @returns the activatable widget for @self
*/
get_activatable_widget(): Gtk.Widget | null;
/**
* Gets the icon name for `self`.
* @returns the icon name for @self
*/
get_icon_name(): string | null;
/**
* Gets the subtitle for `self`.
* @returns the subtitle for @self
*/
get_subtitle(): string | null;
/**
* Gets the number of lines at the end of which the subtitle label will be
* ellipsized.
* @returns the number of lines at the end of which the subtitle label will be ellipsized
*/
get_subtitle_lines(): number;
/**
* Gets whether the user can copy the subtitle from the label
* @returns whether the user can copy the subtitle from the label
*/
get_subtitle_selectable(): boolean;
/**
* Gets the number of lines at the end of which the title label will be
* ellipsized.
* @returns the number of lines at the end of which the title label will be ellipsized
*/
get_title_lines(): number;
/**
* Removes a child from `self`.
* @param widget the child to be removed
*/
remove(widget: Gtk.Widget): void;
/**
* Sets the widget to activate when `self` is activated.
*
* The row can be activated either by clicking on it, calling
* [method`ActionRow`.activate], or via mnemonics in the title.
* See the [property`PreferencesRow:`use-underline] property to enable mnemonics.
*
* The target widget will be activated by emitting the
* [signal`Gtk`.Widget::mnemonic-activate] signal on it.
* @param widget the target widget
*/
set_activatable_widget(widget?: Gtk.Widget | null): void;
/**
* Sets the icon name for `self`.
* @param icon_name the icon name
*/
set_icon_name(icon_name?: string | null): void;
/**
* Sets the subtitle for `self`.
*
* The subtitle is interpreted as Pango markup unless
* [property`PreferencesRow:`use-markup] is set to `FALSE`.
* @param subtitle the subtitle
*/
set_subtitle(subtitle: string): void;
/**
* Sets the number of lines at the end of which the subtitle label will be
* ellipsized.
*
* If the value is 0, the number of lines won't be limited.
* @param subtitle_lines the number of lines at the end of which the subtitle label will be ellipsized
*/
set_subtitle_lines(subtitle_lines: number): void;
/**
* Sets whether the user can copy the subtitle from the label
*
* See also [property`Gtk`.Label:selectable].
* @param subtitle_selectable `TRUE` if the user can copy the subtitle from the label
*/
set_subtitle_selectable(subtitle_selectable: boolean): void;
/**
* Sets the number of lines at the end of which the title label will be
* ellipsized.
*
* If the value is 0, the number of lines won't be limited.
* @param title_lines the number of lines at the end of which the title label will be ellipsized
*/
set_title_lines(title_lines: number): void;
// Inherited properties
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// 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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace AlertDialog {
// Signal callback interfaces
interface Response {
(response: string): void;
}
// Constructor properties interface
interface ConstructorProps
extends Dialog.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.ShortcutManager.ConstructorProps {
body: string;
body_use_markup: boolean;
bodyUseMarkup: boolean;
close_response: string;
closeResponse: string;
default_response: string;
defaultResponse: string;
extra_child: Gtk.Widget;
extraChild: Gtk.Widget;
heading: string;
heading_use_markup: boolean;
headingUseMarkup: boolean;
prefer_wide_layout: boolean;
preferWideLayout: boolean;
}
}
/**
* A dialog presenting a message or a question.
*
* <picture>
* <source srcset="alert-dialog-dark.png" media="(prefers-color-scheme: dark)">
* <img src="alert-dialog.png" alt="alert-dialog">
* </picture>
*
* Alert dialogs have a heading, a body, an optional child widget, and one or
* multiple responses, each presented as a button.
*
* Each response has a unique string ID, and a button label. Additionally, each
* response can be enabled or disabled, and can have a suggested or destructive
* appearance.
*
* When one of the responses is activated, or the dialog is closed, the
* [signal`AlertDialog:`:response] signal will be emitted. This signal is
* detailed, and the detail, as well as the `response` parameter will be set to
* the ID of the activated response, or to the value of the
* [property`AlertDialog:`close-response] property if the dialog had been closed
* without activating any of the responses.
*
* Response buttons can be presented horizontally or vertically depending on
* available space.
*
* When a response is activated, `AdwAlertDialog` is closed automatically.
*
* An example of using an alert dialog:
*
* ```c
* AdwDialog *dialog;
*
* dialog = adw_alert_dialog_new (_("Replace File?"), NULL);
*
* adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog),
* _("A file named “%s” already exists. Do you want to replace it?"),
* filename);
*
* adw_alert_dialog_add_responses (ADW_ALERT_DIALOG (dialog),
* "cancel", _("_Cancel"),
* "replace", _("_Replace"),
* NULL);
*
* adw_alert_dialog_set_response_appearance (ADW_ALERT_DIALOG (dialog),
* "replace",
* ADW_RESPONSE_DESTRUCTIVE);
*
* adw_alert_dialog_set_default_response (ADW_ALERT_DIALOG (dialog), "cancel");
* adw_alert_dialog_set_close_response (ADW_ALERT_DIALOG (dialog), "cancel");
*
* g_signal_connect (dialog, "response", G_CALLBACK (response_cb), self);
*
* adw_dialog_present (dialog, parent);
* ```
*
* ## Async API
*
* `AdwAlertDialog` can also be used via the [method`AlertDialog`.choose] method.
* This API follows the GIO async pattern, for example:
*
* ```c
* static void
* dialog_cb (AdwAlertDialog *dialog,
* GAsyncResult *result,
* MyWindow *self)
* {
* const char *response = adw_alert_dialog_choose_finish (dialog, result);
*
* // ...
* }
*
* static void
* show_dialog (MyWindow *self)
* {
* AdwDialog *dialog;
*
* dialog = adw_alert_dialog_new (_("Replace File?"), NULL);
*
* adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog),
* _("A file named “%s” already exists. Do you want to replace it?"),
* filename);
*
* adw_alert_dialog_add_responses (ADW_ALERT_DIALOG (dialog),
* "cancel", _("_Cancel"),
* "replace", _("_Replace"),
* NULL);
*
* adw_alert_dialog_set_response_appearance (ADW_ALERT_DIALOG (dialog),
* "replace",
* ADW_RESPONSE_DESTRUCTIVE);
*
* adw_alert_dialog_set_default_response (ADW_ALERT_DIALOG (dialog), "cancel");
* adw_alert_dialog_set_close_response (ADW_ALERT_DIALOG (dialog), "cancel");
*
* adw_alert_dialog_choose (ADW_ALERT_DIALOG (dialog), GTK_WIDGET (self),
* NULL, (GAsyncReadyCallback) dialog_cb, self);
* }
* ```
*
* ## AdwAlertDialog as GtkBuildable
*
* `AdwAlertDialog` supports adding responses in UI definitions by via the
* `<responses>` element that may contain multiple `<response>` elements, each
* representing a response.
*
* Each of the `<response>` elements must have the `id` attribute specifying the
* response ID. The contents of the element are used as the response label.
*
* Response labels can be translated with the usual `translatable`, `context`
* and `comments` attributes.
*
* The `<response>` elements can also have `enabled` and/or `appearance`
* attributes. See [method`AlertDialog`.set_response_enabled] and
* [method`AlertDialog`.set_response_appearance] for details.
*
* Example of an `AdwAlertDialog` UI definition:
*
* ```xml
* <object class="AdwAlertDialog" id="dialog">
* <property name="heading" translatable="yes">Save Changes?</property>
* <property name="body" translatable="yes">Open documents contain unsaved changes. Changes which are not saved will be permanently lost.</property>
* <property name="default-response">save</property>
* <property name="close-response">cancel</property>
* <signal name="response" handler="response_cb"/>
* <responses>
* <response id="cancel" translatable="yes">_Cancel</response>
* <response id="discard" translatable="yes" appearance="destructive">_Discard</response>
* <response id="save" translatable="yes" appearance="suggested" enabled="false">_Save</response>
* </responses>
* </object>
* ```
*/
class AlertDialog
extends Dialog
implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.ShortcutManager
{
static $gtype: GObject.GType<AlertDialog>;
// Properties
/**
* The body text of the dialog.
*/
get body(): string;
set body(val: string);
/**
* Whether the body text includes Pango markup.
*
* See [func`Pango`.parse_markup].
*/
get body_use_markup(): boolean;
set body_use_markup(val: boolean);
/**
* Whether the body text includes Pango markup.
*
* See [func`Pango`.parse_markup].
*/
get bodyUseMarkup(): boolean;
set bodyUseMarkup(val: boolean);
/**
* The ID of the close response.
*
* It will be passed to [signal`AlertDialog:`:response] if the dialog is
* closed by pressing <kbd>Escape</kbd> or with a system action.
*
* It doesn't have to correspond to any of the responses in the dialog.
*
* The default close response is `close`.
*/
get close_response(): string;
set close_response(val: string);
/**
* The ID of the close response.
*
* It will be passed to [signal`AlertDialog:`:response] if the dialog is
* closed by pressing <kbd>Escape</kbd> or with a system action.
*
* It doesn't have to correspond to any of the responses in the dialog.
*
* The default close response is `close`.
*/
get closeResponse(): string;
set closeResponse(val: string);
/**
* The response ID of the default response.
*
* If set, pressing <kbd>Enter</kbd> will activate the corresponding button.
*
* If set to `NULL` or a non-existent response ID, pressing <kbd>Enter</kbd>
* will do nothing.
*/
get default_response(): string;
set default_response(val: string);
/**
* The response ID of the default response.
*
* If set, pressing <kbd>Enter</kbd> will activate the corresponding button.
*
* If set to `NULL` or a non-existent response ID, pressing <kbd>Enter</kbd>
* will do nothing.
*/
get defaultResponse(): string;
set defaultResponse(val: string);
/**
* The child widget.
*
* Displayed below the heading and body.
*/
get extra_child(): Gtk.Widget;
set extra_child(val: Gtk.Widget);
/**
* The child widget.
*
* Displayed below the heading and body.
*/
get extraChild(): Gtk.Widget;
set extraChild(val: Gtk.Widget);
/**
* The heading of the dialog.
*/
get heading(): string;
set heading(val: string);
/**
* Whether the heading includes Pango markup.
*
* See [func`Pango`.parse_markup].
*/
get heading_use_markup(): boolean;
set heading_use_markup(val: boolean);
/**
* Whether the heading includes Pango markup.
*
* See [func`Pango`.parse_markup].
*/
get headingUseMarkup(): boolean;
set headingUseMarkup(val: boolean);
/**
* Whether to prefer wide layout.
*
* Prefer horizontal button layout when possible, and wider dialog width
* otherwise.
*/
get prefer_wide_layout(): boolean;
set prefer_wide_layout(val: boolean);
/**
* Whether to prefer wide layout.
*
* Prefer horizontal button layout when possible, and wider dialog width
* otherwise.
*/
get preferWideLayout(): boolean;
set preferWideLayout(val: boolean);
// Constructors
constructor(properties?: Partial<AlertDialog.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](heading?: string | null, body?: string | null): AlertDialog;
// Conflicted with Adw.Dialog.new
static ['new'](...args: never[]): any;
// 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: 'response', callback: (_source: this, response: string) => void): number;
connect_after(signal: 'response', callback: (_source: this, response: string) => void): number;
emit(signal: 'response', response: string): void;
// Virtual methods
vfunc_response(response: string): void;
// Methods
/**
* Adds a response with `id` and `label` to `self`.
*
* Responses are represented as buttons in the dialog.
*
* Response ID must be unique. It will be used in [signal`AlertDialog:`:response]
* to tell which response had been activated, as well as to inspect and modify
* the response later.
*
* An embedded underline in `label` indicates a mnemonic.
*
* [method`AlertDialog`.set_response_label] can be used to change the response
* label after it had been added.
*
* [method`AlertDialog`.set_response_enabled] and
* [method`AlertDialog`.set_response_appearance] can be used to customize the
* responses further.
* @param id the response ID
* @param label the response label
*/
add_response(id: string, label: string): void;
/**
* This function shows `self` to the user.
*
* If the window is an [class`Window]` or [class`ApplicationWindow]`, the dialog
* will be shown within it. Otherwise, it will be a separate window.
* @param parent the parent widget
* @param cancellable a `GCancellable` to cancel the operation
*/
choose(parent?: Gtk.Widget | null, cancellable?: Gio.Cancellable | null): Promise<string>;
/**
* This function shows `self` to the user.
*
* If the window is an [class`Window]` or [class`ApplicationWindow]`, the dialog
* will be shown within it. Otherwise, it will be a separate window.
* @param parent the parent widget
* @param cancellable a `GCancellable` to cancel the operation
* @param callback a callback to call when the operation is complete
*/
choose(
parent: Gtk.Widget | null,
cancellable: Gio.Cancellable | null,
callback: Gio.AsyncReadyCallback<this> | null,
): void;
/**
* This function shows `self` to the user.
*
* If the window is an [class`Window]` or [class`ApplicationWindow]`, the dialog
* will be shown within it. Otherwise, it will be a separate window.
* @param parent the parent widget
* @param cancellable a `GCancellable` to cancel the operation
* @param callback a callback to call when the operation is complete
*/
choose(
parent?: Gtk.Widget | null,
cancellable?: Gio.Cancellable | null,
callback?: Gio.AsyncReadyCallback<this> | null,
): Promise<string> | void;
/**
* Finishes the [method`AlertDialog`.choose] call and returns the response ID.
* @param result a `GAsyncResult`
* @returns the ID of the response that was selected, or [property@AlertDialog:close-response] if the call was cancelled.
*/
choose_finish(result: Gio.AsyncResult): string;
/**
* Gets the body text of `self`.
* @returns the body of @self.
*/
get_body(): string;
/**
* Gets whether the body text of `self` includes Pango markup.
* @returns whether @self uses markup for body text
*/
get_body_use_markup(): boolean;
/**
* Gets the ID of the close response of `self`.
* @returns the close response ID
*/
get_close_response(): string;
/**
* Gets the ID of the default response of `self`.
* @returns the default response ID
*/
get_default_response(): string | null;
/**
* Gets the child widget of `self`.
* @returns the child widget of @self.
*/
get_extra_child(): Gtk.Widget | null;
/**
* Gets the heading of `self`.
* @returns the heading of @self.
*/
get_heading(): string | null;
/**
* Gets whether the heading of `self` includes Pango markup.
* @returns whether @self uses markup for heading
*/
get_heading_use_markup(): boolean;
/**
* Gets whether `self` prefers wide layout.
* @returns whether to prefer wide layout
*/
get_prefer_wide_layout(): boolean;
/**
* Gets the appearance of `response`.
*
* See [method`AlertDialog`.set_response_appearance].
* @param response a response ID
* @returns the appearance of @response
*/
get_response_appearance(response: string): ResponseAppearance;
/**
* Gets whether `response` is enabled.
*
* See [method`AlertDialog`.set_response_enabled].
* @param response a response ID
* @returns whether @response is enabled
*/
get_response_enabled(response: string): boolean;
/**
* Gets the label of `response`.
*
* See [method`AlertDialog`.set_response_label].
* @param response a response ID
* @returns the label of @response
*/
get_response_label(response: string): string;
/**
* Gets whether `self` has a response with the ID `response`.
* @param response response ID
* @returns whether @self has a response with the ID @response.
*/
has_response(response: string): boolean;
/**
* Removes a response from `self`.
* @param id the response ID
*/
remove_response(id: string): void;
/**
* Sets the body text of `self`.
* @param body the body of @self
*/
set_body(body: string): void;
/**
* Sets whether the body text of `self` includes Pango markup.
*
* See [func`Pango`.parse_markup].
* @param use_markup whether to use markup for body text
*/
set_body_use_markup(use_markup: boolean): void;
/**
* Sets the ID of the close response of `self`.
*
* It will be passed to [signal`AlertDialog:`:response] if the dialog is closed
* by pressing <kbd>Escape</kbd> or with a system action.
*
* It doesn't have to correspond to any of the responses in the dialog.
*
* The default close response is `close`.
* @param response the close response ID
*/
set_close_response(response: string): void;
/**
* Sets the ID of the default response of `self`.
*
* If set, pressing <kbd>Enter</kbd> will activate the corresponding button.
*
* If set to `NULL` or to a non-existent response ID, pressing <kbd>Enter</kbd>
* will do nothing.
* @param response the default response ID
*/
set_default_response(response?: string | null): void;
/**
* Sets the child widget of `self`.
*
* The child widget is displayed below the heading and body.
* @param child the child widget
*/
set_extra_child(child?: Gtk.Widget | null): void;
/**
* Sets the heading of `self`.
* @param heading the heading of @self
*/
set_heading(heading?: string | null): void;
/**
* Sets whether the heading of `self` includes Pango markup.
*
* See [func`Pango`.parse_markup].
* @param use_markup whether to use markup for heading
*/
set_heading_use_markup(use_markup: boolean): void;
/**
* Sets whether `self` prefers wide layout.
*
* Prefer horizontal button layout when possible, and wider dialog width
* otherwise.
* @param prefer_wide_layout whether to prefer wide layout
*/
set_prefer_wide_layout(prefer_wide_layout: boolean): void;
/**
* Sets the appearance for `response`.
*
* <picture>
* <source srcset="alert-dialog-appearance-dark.png" media="(prefers-color-scheme: dark)">
* <img src="alert-dialog-appearance.png" alt="alert-dialog-appearance">
* </picture>
*
* Use `ADW_RESPONSE_SUGGESTED` to mark important responses such as the
* affirmative action, like the Save button in the example.
*
* Use `ADW_RESPONSE_DESTRUCTIVE` to draw attention to the potentially damaging
* consequences of using `response`. This appearance acts as a warning to the
* user. The Discard button in the example is using this appearance.
*
* The default appearance is `ADW_RESPONSE_DEFAULT`.
*
* Negative responses like Cancel or Close should use the default appearance.
* @param response a response ID
* @param appearance appearance for @response
*/
set_response_appearance(response: string, appearance: ResponseAppearance | null): void;
/**
* Sets whether `response` is enabled.
*
* If `response` is not enabled, the corresponding button will have
* [property`Gtk`.Widget:sensitive] set to `FALSE` and it can't be activated as
* a default response.
*
* `response` can still be used as [property`AlertDialog:`close-response] while
* it's not enabled.
*
* Responses are enabled by default.
* @param response a response ID
* @param enabled whether to enable @response
*/
set_response_enabled(response: string, enabled: boolean): void;
/**
* Sets the label of `response` to `label`.
*
* Labels are displayed on the dialog buttons. An embedded underline in `label`
* indicates a mnemonic.
* @param response a response ID
* @param label the label of @response
*/
set_response_label(response: string, label: string): void;
// Inherited methods
/**
* Add a `GtkShortcutController` to be managed.
* @param controller
*/
vfunc_add_controller(controller: Gtk.ShortcutController): void;
/**
* Remove a `GtkShortcutController` that had previously
* been added
* @param controller
*/
vfunc_remove_controller(controller: Gtk.ShortcutController): 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 Animation {
// Signal callback interfaces
interface Done {
(): void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
follow_enable_animations_setting: boolean;
followEnableAnimationsSetting: boolean;
state: AnimationState;
target: AnimationTarget;
value: number;
widget: Gtk.Widget;
}
}
/**
* A base class for animations.
*
* `AdwAnimation` represents an animation on a widget. It has a target that
* provides a value to animate, and a state indicating whether the
* animation hasn't been started yet, is playing, paused or finished.
*
* Currently there are two concrete animation types:
* [class`TimedAnimation]` and [class`SpringAnimation]`.
*
* `AdwAnimation` will automatically skip the animation if
* [property`Animation:`widget] is unmapped, or if
* [property`Gtk`.Settings:gtk-enable-animations] is `FALSE`.
*
* The [signal`Animation:`:done] signal can be used to perform an action after
* the animation ends, for example hiding a widget after animating its
* [property`Gtk`.Widget:opacity] to 0.
*
* `AdwAnimation` will be kept alive while the animation is playing. As such,
* it's safe to create an animation, start it and immediately unref it:
* A fire-and-forget animation:
*
* ```c
* static void
* animation_cb (double value,
* MyObject *self)
* {
* // Do something with `value`
* }
*
* static void
* my_object_animate (MyObject *self)
* {
* AdwAnimationTarget *target =
* adw_callback_animation_target_new ((AdwAnimationTargetFunc) animation_cb,
* self, NULL);
* g_autoptr (AdwAnimation) animation =
* adw_timed_animation_new (widget, 0, 1, 250, target);
*
* adw_animation_play (animation);
* }
* ```
*
* If there's a chance the previous animation for the same target hasn't yet
* finished, the previous animation should be stopped first, or the existing
* `AdwAnimation` object can be reused.
*/
abstract class Animation extends GObject.Object {
static $gtype: GObject.GType<Animation>;
// Properties
/**
* Whether to skip the animation when animations are globally disabled.
*
* The default behavior is to skip the animation. Set to `FALSE` to disable
* this behavior.
*
* This can be useful for cases where animation is essential, like spinners,
* or in demo applications. Most other animations should keep it enabled.
*
* See [property`Gtk`.Settings:gtk-enable-animations].
*/
get follow_enable_animations_setting(): boolean;
set follow_enable_animations_setting(val: boolean);
/**
* Whether to skip the animation when animations are globally disabled.
*
* The default behavior is to skip the animation. Set to `FALSE` to disable
* this behavior.
*
* This can be useful for cases where animation is essential, like spinners,
* or in demo applications. Most other animations should keep it enabled.
*
* See [property`Gtk`.Settings:gtk-enable-animations].
*/
get followEnableAnimationsSetting(): boolean;
set followEnableAnimationsSetting(val: boolean);
/**
* The animation state.
*
* The state indicates whether the animation is currently playing, paused,
* finished or hasn't been started yet.
*/
get state(): AnimationState;
/**
* The target to animate.
*/
get target(): AnimationTarget;
set target(val: AnimationTarget);
/**
* The current value of the animation.
*/
get value(): number;
/**
* The animation widget.
*
* It provides the frame clock for the animation. It's not strictly necessary
* for this widget to be same as the one being animated.
*
* The widget must be mapped in order for the animation to work. If it's not
* mapped, or if it gets unmapped during an ongoing animation, the animation
* will be automatically skipped.
*/
get widget(): Gtk.Widget;
// Constructors
constructor(properties?: Partial<Animation.ConstructorProps>, ...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: 'done', callback: (_source: this) => void): number;
connect_after(signal: 'done', callback: (_source: this) => void): number;
emit(signal: 'done'): void;
// Methods
/**
* Gets whether `self` should be skipped when animations are globally disabled.
* @returns whether to follow the global setting
*/
get_follow_enable_animations_setting(): boolean;
/**
* Gets the current value of `self`.
*
* The state indicates whether `self` is currently playing, paused, finished or
* hasn't been started yet.
* @returns the animation value
*/
get_state(): AnimationState;
/**
* Gets the target `self` animates.
* @returns the animation target
*/
get_target(): AnimationTarget;
/**
* Gets the current value of `self`.
* @returns the current value
*/
get_value(): number;
/**
* Gets the widget `self` was created for.
*
* It provides the frame clock for the animation. It's not strictly necessary
* for this widget to be same as the one being animated.
*
* The widget must be mapped in order for the animation to work. If it's not
* mapped, or if it gets unmapped during an ongoing animation, the animation
* will be automatically skipped.
* @returns the animation widget
*/
get_widget(): Gtk.Widget;
/**
* Pauses a playing animation for `self`.
*
* Does nothing if the current state of `self` isn't `ADW_ANIMATION_PLAYING`.
*
* Sets [property`Animation:`state] to `ADW_ANIMATION_PAUSED`.
*/
pause(): void;
/**
* Starts the animation for `self`.
*
* If the animation is playing, paused or has been completed, restarts it from
* the beginning. This allows to easily play an animation regardless of whether
* it's already playing or not.
*
* Sets [property`Animation:`state] to `ADW_ANIMATION_PLAYING`.
*
* The animation will be automatically skipped if [property`Animation:`widget] is
* unmapped, or if [property`Gtk`.Settings:gtk-enable-animations] is `FALSE`.
*
* As such, it's not guaranteed that the animation will actually run. For
* example, when using [func`GLib`.idle_add] and starting an animation
* immediately afterwards, it's entirely possible that the idle callback will
* run after the animation has already finished, and not while it's playing.
*/
play(): void;
/**
* Resets the animation for `self`.
*
* Sets [property`Animation:`state] to `ADW_ANIMATION_IDLE`.
*/
reset(): void;
/**
* Resumes a paused animation for `self`.
*
* This function must only be used if the animation has been paused with
* [method`Animation`.pause].
*
* Sets [property`Animation:`state] to `ADW_ANIMATION_PLAYING`.
*/
resume(): void;
/**
* Sets whether to skip `self` when animations are globally disabled.
*
* The default behavior is to skip the animation. Set to `FALSE` to disable this
* behavior.
*
* This can be useful for cases where animation is essential, like spinners, or
* in demo applications. Most other animations should keep it enabled.
*
* See [property`Gtk`.Settings:gtk-enable-animations].
* @param setting whether to follow the global setting
*/
set_follow_enable_animations_setting(setting: boolean): void;
/**
* Sets the target `self` animates to `target`.
* @param target an animation target
*/
set_target(target: AnimationTarget): void;
/**
* Skips the animation for `self`.
*
* If the animation hasn't been started yet, is playing, or is paused, instantly
* skips the animation to the end and causes [signal`Animation:`:done] to be
* emitted.
*
* Sets [property`Animation:`state] to `ADW_ANIMATION_FINISHED`.
*/
skip(): void;
}
namespace AnimationTarget {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {}
}
/**
* Represents a value [class`Animation]` can animate.
*/
abstract class AnimationTarget extends GObject.Object {
static $gtype: GObject.GType<AnimationTarget>;
// Constructors
constructor(properties?: Partial<AnimationTarget.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
}
namespace Application {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Application.ConstructorProps,
Gio.ActionGroup.ConstructorProps,
Gio.ActionMap.ConstructorProps {
style_manager: StyleManager;
styleManager: StyleManager;
}
}
/**
* A base class for Adwaita applications.
*
* `AdwApplication` handles library initialization by calling [func`init]` in the
* default [signal`Gio`.Application::startup] signal handler, in turn chaining up
* as required by [class`Gtk`.Application]. Therefore, any subclass of
* `AdwApplication` should always chain up its `startup` handler before using
* any Adwaita or GTK API.
*
* ## Automatic Resources
*
* `AdwApplication` will automatically load stylesheets located in the
* application's resource base path (see
* [method`Gio`.Application.set_resource_base_path], if they're present.
*
* They can be used to add custom styles to the application, as follows:
*
* - `style.css` contains styles that are always present.
*
* - `style-dark.css` contains styles only used when
* [property`StyleManager:`dark] is `TRUE`.
*
* - `style-hc.css` contains styles used when the system high contrast
* preference is enabled.
*
* - `style-hc-dark.css` contains styles used when the system high contrast
* preference is enabled and [property`StyleManager:`dark] is `TRUE`.
*/
class Application extends Gtk.Application implements Gio.ActionGroup, Gio.ActionMap {
static $gtype: GObject.GType<Application>;
// Properties
/**
* The style manager for this application.
*
* This is a convenience property allowing to access `AdwStyleManager` through
* property bindings or expressions.
*/
get style_manager(): StyleManager;
/**
* The style manager for this application.
*
* This is a convenience property allowing to access `AdwStyleManager` through
* property bindings or expressions.
*/
get styleManager(): StyleManager;
// Constructors
constructor(properties?: Partial<Application.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](application_id: string | null, flags: Gio.ApplicationFlags): Application;
// Methods
/**
* Gets the style manager for `self`.
*
* This is a convenience property allowing to access `AdwStyleManager` through
* property bindings or expressions.
* @returns the style manager
*/
get_style_manager(): StyleManager;
// 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 ApplicationWindow {
// Constructor properties interface
interface ConstructorProps
extends Gtk.ApplicationWindow.ConstructorProps,
Gio.ActionGroup.ConstructorProps,
Gio.ActionMap.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Native.ConstructorProps,
Gtk.Root.ConstructorProps,
Gtk.ShortcutManager.ConstructorProps {
adaptive_preview: boolean;
adaptivePreview: boolean;
content: Gtk.Widget;
current_breakpoint: Breakpoint;
currentBreakpoint: Breakpoint;
dialogs: Gio.ListModel;
visible_dialog: Dialog;
visibleDialog: Dialog;
}
}
/**
* A freeform application window.
*
* <picture>
* <source srcset="application-window-dark.png" media="(prefers-color-scheme: dark)">
* <img src="application-window.png" alt="application-window">
* </picture>
*
* `AdwApplicationWindow` is a [class`Gtk`.ApplicationWindow] subclass providing
* the same features as [class`Window]`.
*
* See [class`Window]` for details.
*
* Example of an `AdwApplicationWindow` UI definition:
*
* ```xml
* <object class="AdwApplicationWindow">
* <property name="content">
* <object class="AdwToolbarView">
* <child type="top">
* <object class="AdwHeaderBar"/>
* </child>
* <property name="content">
* <!-- ... -->
* </property>
* </object>
* </property>
* </object>
* ```
*
* Using [property`Gtk`.Application:menubar] is not supported and may result in
* visual glitches.
*/
class ApplicationWindow
extends Gtk.ApplicationWindow
implements
Gio.ActionGroup,
Gio.ActionMap,
Gtk.Accessible,
Gtk.Buildable,
Gtk.ConstraintTarget,
Gtk.Native,
Gtk.Root,
Gtk.ShortcutManager
{
static $gtype: GObject.GType<ApplicationWindow>;
// Properties
/**
* Whether adaptive preview is currently open.
*
* Adaptive preview is a debugging tool used for testing the window
* contents at specific screen sizes, simulating mobile environment.
*
* Adaptive preview can always be accessed from inspector. This function
* allows applications to open it manually.
*
* Most applications should not use this property.
*/
get adaptive_preview(): boolean;
set adaptive_preview(val: boolean);
/**
* Whether adaptive preview is currently open.
*
* Adaptive preview is a debugging tool used for testing the window
* contents at specific screen sizes, simulating mobile environment.
*
* Adaptive preview can always be accessed from inspector. This function
* allows applications to open it manually.
*
* Most applications should not use this property.
*/
get adaptivePreview(): boolean;
set adaptivePreview(val: boolean);
/**
* The content widget.
*
* This property should always be used instead of [property`Gtk`.Window:child].
*/
get content(): Gtk.Widget;
set content(val: Gtk.Widget);
/**
* The current breakpoint.
*/
get current_breakpoint(): Breakpoint;
/**
* The current breakpoint.
*/
get currentBreakpoint(): Breakpoint;
/**
* The open dialogs.
*/
get dialogs(): Gio.ListModel;
/**
* The currently visible dialog
*/
get visible_dialog(): Dialog;
/**
* The currently visible dialog
*/
get visibleDialog(): Dialog;
// Constructors
constructor(properties?: Partial<ApplicationWindow.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](app: Gtk.Application): ApplicationWindow;
// Conflicted with Gtk.Window.new
static ['new'](...args: never[]): any;
// Methods
/**
* Adds `breakpoint` to `self`.
* @param breakpoint the breakpoint to add
*/
add_breakpoint(breakpoint: Breakpoint): void;
/**
* Gets whether adaptive preview for `self` is currently open.
* @returns whether adaptive preview is open.
*/
get_adaptive_preview(): boolean;
/**
* Gets the content widget of `self`.
*
* This method should always be used instead of [method`Gtk`.Window.get_child].
* @returns the content widget of @self
*/
get_content(): Gtk.Widget | null;
/**
* Gets the current breakpoint.
* @returns the current breakpoint
*/
get_current_breakpoint(): Breakpoint | null;
/**
* Returns a [iface`Gio`.ListModel] that contains the open dialogs of `self`.
*
* This can be used to keep an up-to-date view.
* @returns a list model for the dialogs of @self
*/
get_dialogs(): Gio.ListModel;
/**
* Returns the currently visible dialog in `self,` if there's one.
* @returns the visible dialog
*/
get_visible_dialog(): Dialog | null;
/**
* Sets whether adaptive preview for `self` is currently open.
*
* Adaptive preview is a debugging tool used for testing the window
* contents at specific screen sizes, simulating mobile environment.
*
* Adaptive preview can always be accessed from inspector. This function
* allows applications to open it manually.
*
* Most applications should not use this function.
* @param adaptive_preview whether to open adaptive preview
*/
set_adaptive_preview(adaptive_preview: boolean): void;
/**
* Sets the content widget of `self`.
*
* This method should always be used instead of [method`Gtk`.Window.set_child].
* @param content the content widget
*/
set_content(content?: Gtk.Widget | null): void;
// Inherited properties
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// Inherited methods
/**
* Emits the [signal`Gio`.ActionGroup::action-added] signal on `action_group`.
*
* This function should only be called by [type`Gio`.ActionGroup] implementations.
* @param action_name the name of an action in the group
*/
action_added(action_name: string): void;
/**
* Emits the [signal`Gio`.ActionGroup::action-enabled-changed] signal on `action_group`.
*
* This function should only be called by [type`Gio`.ActionGroup] implementations.
* @param action_name the name of an action in the group
* @param enabled whether the action is now enabled
*/
action_enabled_changed(action_name: string, enabled: boolean): void;
/**
* Emits the [signal`Gio`.ActionGroup::action-removed] signal on `action_group`.
*
* This function should only be called by [type`Gio`.ActionGroup] implementations.
* @param action_name the name of an action in the group
*/
action_removed(action_name: string): void;
/**
* Emits the [signal`Gio`.ActionGroup::action-state-changed] signal on `action_group`.
*
* This function should only be called by [type`Gio`.ActionGroup] implementations.
* @param action_name the name of an action in the group
* @param state the new state of the named action
*/
action_state_changed(action_name: string, state: GLib.Variant): void;
/**
* Activate the named action within `action_group`.
*
* If the action is expecting a parameter, then the correct type of
* parameter must be given as `parameter`. If the action is expecting no
* parameters then `parameter` must be `NULL`. See
* [method`Gio`.ActionGroup.get_action_parameter_type].
*
* If the [type`Gio`.ActionGroup] implementation supports asynchronous remote
* activation over D-Bus, this call may return before the relevant
* D-Bus traffic has been sent, or any replies have been received. In
* order to block on such asynchronous activation calls,
* [method`Gio`.DBusConnection.flush] should be called prior to the code, which
* depends on the result of the action activation. Without flushing
* the D-Bus connection, there is no guarantee that the action would
* have been activated.
*
* The following code which runs in a remote app instance, shows an
* example of a quit action being activated on the primary app
* instance over D-Bus. Here [method`Gio`.DBusConnection.flush] is called
* before `exit()`. Without `g_dbus_connection_flush()`, the quit action
* may fail to be activated on the primary instance.
*
* ```c
* // call quit action on primary instance
* g_action_group_activate_action (G_ACTION_GROUP (app), "quit", NULL);
*
* // make sure the action is activated now
* g_dbus_connection_flush (…);
*
* g_debug ("Application has been terminated. Exiting.");
*
* exit (0);
* ```
* @param action_name the name of the action to activate
* @param parameter parameters to the activation
*/
activate_action(action_name: string, parameter?: GLib.Variant | null): void;
// Conflicted with Gtk.Widget.activate_action
activate_action(...args: never[]): any;
/**
* Request for the state of the named action within `action_group` to be
* changed to `value`.
*
* The action must be stateful and `value` must be of the correct type.
* See [method`Gio`.ActionGroup.get_action_state_type].
*
* This call merely requests a change. The action may refuse to change
* its state or may change its state to something other than `value`.
* See [method`Gio`.ActionGroup.get_action_state_hint].
*
* If the `value` GVariant is floating, it is consumed.
* @param action_name the name of the action to request the change on
* @param value the new state
*/
change_action_state(action_name: string, value: GLib.Variant): void;
/**
* Checks if the named action within `action_group` is currently enabled.
*
* An action must be enabled in order to be activated or in order to
* have its state changed from outside callers.
* @param action_name the name of the action to query
* @returns whether the action is currently enabled
*/
get_action_enabled(action_name: string): boolean;
/**
* Queries the type of the parameter that must be given when activating
* the named action within `action_group`.
*
* When activating the action using [method`Gio`.ActionGroup.activate_action],
* the [type`GLib`.Variant] given to that function must be of the type returned
* by this function.
*
* In the case that this function returns `NULL`, you must not give any
* [type`GLib`.Variant], but `NULL` instead.
*
* The parameter type of a particular action will never change but it is
* possible for an action to be removed and for a new action to be added
* with the same name but a different parameter type.
* @param action_name the name of the action to query
* @returns the parameter type
*/
get_action_parameter_type(action_name: string): GLib.VariantType | null;
/**
* Queries the current state of the named action within `action_group`.
*
* If the action is not stateful then `NULL` will be returned. If the
* action is stateful then the type of the return value is the type
* given by [method`Gio`.ActionGroup.get_action_state_type].
*
* The return value (if non-`NULL`) should be freed with
* [method`GLib`.Variant.unref] when it is no longer required.
* @param action_name the name of the action to query
* @returns the current state of the action
*/
get_action_state(action_name: string): GLib.Variant | null;
/**
* Requests a hint about the valid range of values for the state of the
* named action within `action_group`.
*
* If `NULL` is returned it either means that the action is not stateful
* or that there is no hint about the valid range of values for the
* state of the action.
*
* If a [type`GLib`.Variant] array is returned then each item in the array is a
* possible value for the state. If a [type`GLib`.Variant] pair (ie: two-tuple) is
* returned then the tuple specifies the inclusive lower and upper bound
* of valid values for the state.
*
* In any case, the information is merely a hint. It may be possible to
* have a state value outside of the hinted range and setting a value
* within the range may fail.
*
* The return value (if non-`NULL`) should be freed with
* [method`GLib`.Variant.unref] when it is no longer required.
* @param action_name the name of the action to query
* @returns the state range hint
*/
get_action_state_hint(action_name: string): GLib.Variant | null;
/**
* Queries the type of the state of the named action within
* `action_group`.
*
* If the action is stateful then this function returns the
* [type`GLib`.VariantType] of the state. All calls to
* [method`Gio`.ActionGroup.change_action_state] must give a [type`GLib`.Variant] of this
* type and [method`Gio`.ActionGroup.get_action_state] will return a [type`GLib`.Variant]
* of the same type.
*
* If the action is not stateful then this function will return `NULL`.
* In that case, [method`Gio`.ActionGroup.get_action_state] will return `NULL`
* and you must not call [method`Gio`.ActionGroup.change_action_state].
*
* The state type of a particular action will never change but it is
* possible for an action to be removed and for a new action to be added
* with the same name but a different state type.
* @param action_name the name of the action to query
* @returns the state type, if the action is stateful
*/
get_action_state_type(action_name: string): GLib.VariantType | null;
/**
* Checks if the named action exists within `action_group`.
* @param action_name the name of the action to check for
* @returns whether the named action exists
*/
has_action(action_name: string): boolean;
/**
* Lists the actions contained within `action_group`.
*
* The caller is responsible for freeing the list with [func`GLib`.strfreev] when
* it is no longer required.
* @returns a `NULL`-terminated array of the names of the actions in the group
*/
list_actions(): string[];
/**
* Queries all aspects of the named action within an `action_group`.
*
* This function acquires the information available from
* [method`Gio`.ActionGroup.has_action], [method`Gio`.ActionGroup.get_action_enabled],
* [method`Gio`.ActionGroup.get_action_parameter_type],
* [method`Gio`.ActionGroup.get_action_state_type],
* [method`Gio`.ActionGroup.get_action_state_hint] and
* [method`Gio`.ActionGroup.get_action_state] with a single function call.
*
* This provides two main benefits.
*
* The first is the improvement in efficiency that comes with not having
* to perform repeated lookups of the action in order to discover
* different things about it. The second is that implementing
* [type`Gio`.ActionGroup] can now be done by only overriding this one virtual
* function.
*
* The interface provides a default implementation of this function that
* calls the individual functions, as required, to fetch the
* information. The interface also provides default implementations of
* those functions that call this function. All implementations,
* therefore, must override either this function or all of the others.
*
* If the action exists, `TRUE` is returned and any of the requested
* fields (as indicated by having a non-`NULL` reference passed in) are
* filled. If the action doesnt exist, `FALSE` is returned and the
* fields may or may not have been modified.
* @param action_name the name of an action in the group
* @returns `TRUE` if the action exists, else `FALSE`
*/
query_action(
action_name: string,
): [
boolean,
boolean,
GLib.VariantType | null,
GLib.VariantType | null,
GLib.Variant | null,
GLib.Variant | null,
];
/**
* Emits the [signal`Gio`.ActionGroup::action-added] signal on `action_group`.
*
* This function should only be called by [type`Gio`.ActionGroup] implementations.
* @param action_name the name of an action in the group
*/
vfunc_action_added(action_name: string): void;
/**
* Emits the [signal`Gio`.ActionGroup::action-enabled-changed] signal on `action_group`.
*
* This function should only be called by [type`Gio`.ActionGroup] implementations.
* @param action_name the name of an action in the group
* @param enabled whether the action is now enabled
*/
vfunc_action_enabled_changed(action_name: string, enabled: boolean): void;
/**
* Emits the [signal`Gio`.ActionGroup::action-removed] signal on `action_group`.
*
* This function should only be called by [type`Gio`.ActionGroup] implementations.
* @param action_name the name of an action in the group
*/
vfunc_action_removed(action_name: string): void;
/**
* Emits the [signal`Gio`.ActionGroup::action-state-changed] signal on `action_group`.
*
* This function should only be called by [type`Gio`.ActionGroup] implementations.
* @param action_name the name of an action in the group
* @param state the new state of the named action
*/
vfunc_action_state_changed(action_name: string, state: GLib.Variant): void;
/**
* Activate the named action within `action_group`.
*
* If the action is expecting a parameter, then the correct type of
* parameter must be given as `parameter`. If the action is expecting no
* parameters then `parameter` must be `NULL`. See
* [method`Gio`.ActionGroup.get_action_parameter_type].
*
* If the [type`Gio`.ActionGroup] implementation supports asynchronous remote
* activation over D-Bus, this call may return before the relevant
* D-Bus traffic has been sent, or any replies have been received. In
* order to block on such asynchronous activation calls,
* [method`Gio`.DBusConnection.flush] should be called prior to the code, which
* depends on the result of the action activation. Without flushing
* the D-Bus connection, there is no guarantee that the action would
* have been activated.
*
* The following code which runs in a remote app instance, shows an
* example of a quit action being activated on the primary app
* instance over D-Bus. Here [method`Gio`.DBusConnection.flush] is called
* before `exit()`. Without `g_dbus_connection_flush()`, the quit action
* may fail to be activated on the primary instance.
*
* ```c
* // call quit action on primary instance
* g_action_group_activate_action (G_ACTION_GROUP (app), "quit", NULL);
*
* // make sure the action is activated now
* g_dbus_connection_flush (…);
*
* g_debug ("Application has been terminated. Exiting.");
*
* exit (0);
* ```
* @param action_name the name of the action to activate
* @param parameter parameters to the activation
*/
vfunc_activate_action(action_name: string, parameter?: GLib.Variant | null): void;
/**
* Request for the state of the named action within `action_group` to be
* changed to `value`.
*
* The action must be stateful and `value` must be of the correct type.
* See [method`Gio`.ActionGroup.get_action_state_type].
*
* This call merely requests a change. The action may refuse to change
* its state or may change its state to something other than `value`.
* See [method`Gio`.ActionGroup.get_action_state_hint].
*
* If the `value` GVariant is floating, it is consumed.
* @param action_name the name of the action to request the change on
* @param value the new state
*/
vfunc_change_action_state(action_name: string, value: GLib.Variant): void;
/**
* Checks if the named action within `action_group` is currently enabled.
*
* An action must be enabled in order to be activated or in order to
* have its state changed from outside callers.
* @param action_name the name of the action to query
*/
vfunc_get_action_enabled(action_name: string): boolean;
/**
* Queries the type of the parameter that must be given when activating
* the named action within `action_group`.
*
* When activating the action using [method`Gio`.ActionGroup.activate_action],
* the [type`GLib`.Variant] given to that function must be of the type returned
* by this function.
*
* In the case that this function returns `NULL`, you must not give any
* [type`GLib`.Variant], but `NULL` instead.
*
* The parameter type of a particular action will never change but it is
* possible for an action to be removed and for a new action to be added
* with the same name but a different parameter type.
* @param action_name the name of the action to query
*/
vfunc_get_action_parameter_type(action_name: string): GLib.VariantType | null;
/**
* Queries the current state of the named action within `action_group`.
*
* If the action is not stateful then `NULL` will be returned. If the
* action is stateful then the type of the return value is the type
* given by [method`Gio`.ActionGroup.get_action_state_type].
*
* The return value (if non-`NULL`) should be freed with
* [method`GLib`.Variant.unref] when it is no longer required.
* @param action_name the name of the action to query
*/
vfunc_get_action_state(action_name: string): GLib.Variant | null;
/**
* Requests a hint about the valid range of values for the state of the
* named action within `action_group`.
*
* If `NULL` is returned it either means that the action is not stateful
* or that there is no hint about the valid range of values for the
* state of the action.
*
* If a [type`GLib`.Variant] array is returned then each item in the array is a
* possible value for the state. If a [type`GLib`.Variant] pair (ie: two-tuple) is
* returned then the tuple specifies the inclusive lower and upper bound
* of valid values for the state.
*
* In any case, the information is merely a hint. It may be possible to
* have a state value outside of the hinted range and setting a value
* within the range may fail.
*
* The return value (if non-`NULL`) should be freed with
* [method`GLib`.Variant.unref] when it is no longer required.
* @param action_name the name of the action to query
*/
vfunc_get_action_state_hint(action_name: string): GLib.Variant | null;
/**
* Queries the type of the state of the named action within
* `action_group`.
*
* If the action is stateful then this function returns the
* [type`GLib`.VariantType] of the state. All calls to
* [method`Gio`.ActionGroup.change_action_state] must give a [type`GLib`.Variant] of this
* type and [method`Gio`.ActionGroup.get_action_state] will return a [type`GLib`.Variant]
* of the same type.
*
* If the action is not stateful then this function will return `NULL`.
* In that case, [method`Gio`.ActionGroup.get_action_state] will return `NULL`
* and you must not call [method`Gio`.ActionGroup.change_action_state].
*
* The state type of a particular action will never change but it is
* possible for an action to be removed and for a new action to be added
* with the same name but a different state type.
* @param action_name the name of the action to query
*/
vfunc_get_action_state_type(action_name: string): GLib.VariantType | null;
/**
* Checks if the named action exists within `action_group`.
* @param action_name the name of the action to check for
*/
vfunc_has_action(action_name: string): boolean;
/**
* Lists the actions contained within `action_group`.
*
* The caller is responsible for freeing the list with [func`GLib`.strfreev] when
* it is no longer required.
*/
vfunc_list_actions(): string[];
/**
* Queries all aspects of the named action within an `action_group`.
*
* This function acquires the information available from
* [method`Gio`.ActionGroup.has_action], [method`Gio`.ActionGroup.get_action_enabled],
* [method`Gio`.ActionGroup.get_action_parameter_type],
* [method`Gio`.ActionGroup.get_action_state_type],
* [method`Gio`.ActionGroup.get_action_state_hint] and
* [method`Gio`.ActionGroup.get_action_state] with a single function call.
*
* This provides two main benefits.
*
* The first is the improvement in efficiency that comes with not having
* to perform repeated lookups of the action in order to discover
* different things about it. The second is that implementing
* [type`Gio`.ActionGroup] can now be done by only overriding this one virtual
* function.
*
* The interface provides a default implementation of this function that
* calls the individual functions, as required, to fetch the
* information. The interface also provides default implementations of
* those functions that call this function. All implementations,
* therefore, must override either this function or all of the others.
*
* If the action exists, `TRUE` is returned and any of the requested
* fields (as indicated by having a non-`NULL` reference passed in) are
* filled. If the action doesnt exist, `FALSE` is returned and the
* fields may or may not have been modified.
* @param action_name the name of an action in the group
*/
vfunc_query_action(
action_name: string,
): [
boolean,
boolean,
GLib.VariantType | null,
GLib.VariantType | null,
GLib.Variant | null,
GLib.Variant | null,
];
/**
* Adds an action to the `action_map`.
*
* If the action map already contains an action with the same name
* as `action` then the old action is dropped from the action map.
*
* The action map takes its own reference on `action`.
* @param action a [iface@Gio.Action]
*/
add_action(action: Gio.Action): void;
/**
* A convenience function for creating multiple simple actions.
* See Gio.ActionEntryObj for the structure of the action entry.
* @param entries Array of action entries to add
*/
add_action_entries(entries: Gio.ActionEntryObj[]): void;
/**
* Looks up the action with the name `action_name` in `action_map`.
*
* If no such action exists, returns `NULL`.
* @param action_name the name of an action
* @returns a [iface@Gio.Action]
*/
lookup_action(action_name: string): Gio.Action | null;
/**
* Removes the named action from the action map.
*
* If no action of this name is in the map then nothing happens.
* @param action_name the name of the action
*/
remove_action(action_name: string): void;
/**
* Remove actions from a [iface`Gio`.ActionMap]. This is meant as the reverse of
* [method`Gio`.ActionMap.add_action_entries].
*
*
* ```c
* static const GActionEntry entries[] = {
* { "quit", activate_quit },
* { "print-string", activate_print_string, "s" }
* };
*
* void
* add_actions (GActionMap *map)
* {
* g_action_map_add_action_entries (map, entries, G_N_ELEMENTS (entries), NULL);
* }
*
* void
* remove_actions (GActionMap *map)
* {
* g_action_map_remove_action_entries (map, entries, G_N_ELEMENTS (entries));
* }
* ```
* @param entries a pointer to the first item in an array of [struct@Gio.ActionEntry] structs
*/
remove_action_entries(entries: Gio.ActionEntry[]): void;
/**
* Adds an action to the `action_map`.
*
* If the action map already contains an action with the same name
* as `action` then the old action is dropped from the action map.
*
* The action map takes its own reference on `action`.
* @param action a [iface@Gio.Action]
*/
vfunc_add_action(action: Gio.Action): void;
/**
* Looks up the action with the name `action_name` in `action_map`.
*
* If no such action exists, returns `NULL`.
* @param action_name the name of an action
*/
vfunc_lookup_action(action_name: string): Gio.Action | null;
/**
* Removes the named action from the action map.
*
* If no action of this name is in the map then nothing happens.
* @param action_name the name of the action
*/
vfunc_remove_action(action_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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace Avatar {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
custom_image: Gdk.Paintable;
customImage: Gdk.Paintable;
icon_name: string;
iconName: string;
show_initials: boolean;
showInitials: boolean;
size: number;
text: string;
}
}
/**
* A widget displaying an image, with a generated fallback.
*
* <picture>
* <source srcset="avatar-dark.png" media="(prefers-color-scheme: dark)">
* <img src="avatar.png" alt="avatar">
* </picture>
*
* `AdwAvatar` is a widget that shows a round avatar.
*
* `AdwAvatar` generates an avatar with the initials of the
* [property`Avatar:`text] on top of a colored background.
*
* The color is picked based on the hash of the [property`Avatar:`text].
*
* If [property`Avatar:`show-initials] is set to `FALSE`,
* [property`Avatar:`icon-name] or `avatar-default-symbolic` is shown instead of
* the initials.
*
* Use [property`Avatar:`custom-image] to set a custom image.
*
* ## CSS nodes
*
* `AdwAvatar` has a single CSS node with name `avatar`.
*
* ## Accessibility
*
* `AdwAvatar` uses the `GTK_ACCESSIBLE_ROLE_IMG` role.
*/
class Avatar extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<Avatar>;
// Properties
/**
* A custom image paintable.
*
* Custom image is displayed instead of initials or icon.
*/
get custom_image(): Gdk.Paintable;
set custom_image(val: Gdk.Paintable);
/**
* A custom image paintable.
*
* Custom image is displayed instead of initials or icon.
*/
get customImage(): Gdk.Paintable;
set customImage(val: Gdk.Paintable);
/**
* The name of an icon to use as a fallback.
*
* If no name is set, `avatar-default-symbolic` will be used.
*/
get icon_name(): string;
set icon_name(val: string);
/**
* The name of an icon to use as a fallback.
*
* If no name is set, `avatar-default-symbolic` will be used.
*/
get iconName(): string;
set iconName(val: string);
/**
* Whether initials are used instead of an icon on the fallback avatar.
*
* See [property`Avatar:`icon-name] for how to change the fallback icon.
*/
get show_initials(): boolean;
set show_initials(val: boolean);
/**
* Whether initials are used instead of an icon on the fallback avatar.
*
* See [property`Avatar:`icon-name] for how to change the fallback icon.
*/
get showInitials(): boolean;
set showInitials(val: boolean);
/**
* The size of the avatar.
*/
get size(): number;
set size(val: number);
/**
* Sets the text used to generate the fallback initials and color.
*
* It's only used to generate the color if [property`Avatar:`show-initials] is
* `FALSE`.
*/
get text(): string;
set text(val: string);
// Constructors
constructor(properties?: Partial<Avatar.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](size: number, text: string | null, show_initials: boolean): Avatar;
// Methods
/**
* Renders `self` into a [class`Gdk`.Texture] at `scale_factor`.
*
* This can be used to export the fallback avatar.
* @param scale_factor The scale factor
* @returns the texture
*/
draw_to_texture(scale_factor: number): Gdk.Texture;
/**
* Gets the custom image paintable.
* @returns the custom image
*/
get_custom_image(): Gdk.Paintable | null;
/**
* Gets the name of an icon to use as a fallback.
* @returns the icon name
*/
get_icon_name(): string | null;
/**
* Gets whether initials are used instead of an icon on the fallback avatar.
* @returns whether initials are used instead of an icon as fallback
*/
get_show_initials(): boolean;
/**
* Gets the size of the avatar.
* @returns the size of the avatar
*/
get_size(): number;
/**
* Gets the text used to generate the fallback initials and color.
* @returns the text used to generate the fallback initials and color
*/
get_text(): string | null;
/**
* Sets the custom image paintable.
*
* Custom image is displayed instead of initials or icon.
* @param custom_image a custom image
*/
set_custom_image(custom_image?: Gdk.Paintable | null): void;
/**
* Sets the name of an icon to use as a fallback.
*
* If no name is set, `avatar-default-symbolic` will be used.
* @param icon_name the icon name
*/
set_icon_name(icon_name?: string | null): void;
/**
* Sets whether to use initials instead of an icon on the fallback avatar.
*
* See [property`Avatar:`icon-name] for how to change the fallback icon.
* @param show_initials whether to use initials instead of an icon as fallback
*/
set_show_initials(show_initials: boolean): void;
/**
* Sets the size of the avatar.
* @param size The size of the avatar
*/
set_size(size: number): void;
/**
* Sets the text used to generate the fallback initials and color.
*
* It's only used to generate the color if [property`Avatar:`show-initials] is
* `FALSE`.
* @param text the text used to get the initials and color
*/
set_text(text?: string | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 Banner {
// Signal callback interfaces
interface ButtonClicked {
(): void;
}
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Actionable.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
button_label: string;
buttonLabel: string;
button_style: BannerButtonStyle;
buttonStyle: BannerButtonStyle;
revealed: boolean;
title: string;
use_markup: boolean;
useMarkup: boolean;
}
}
/**
* A bar with contextual information.
*
* <picture>
* <source srcset="banner-dark.png" media="(prefers-color-scheme: dark)">
* <img src="banner.png" alt="banner">
* </picture>
*
* Banners are hidden by default, use [property`Banner:`revealed] to show them.
*
* Banners have a title, set with [property`Banner:`title]. Titles can be marked
* up with Pango markup, use [property`Banner:`use-markup] to enable it.
*
* The title will be shown centered or left-aligned depending on available
* space.
*
* Banners can optionally have a button with text on it, set through
* [property`Banner:`button-label]. The button can be used with a `GAction`,
* or with the [signal`Banner:`:button-clicked] signal. The button can have
* different styles, a gray style and a suggested style.
*
* <picture>
* <source srcset="banner-suggested-dark.png" media="(prefers-color-scheme: dark)">
* <img src="banner-suggested.png" alt="banner with suggested button style">
* </picture>
*
* ## CSS nodes
*
* `AdwBanner` has a main CSS node with the name `banner`.
*/
class Banner extends Gtk.Widget implements Gtk.Accessible, Gtk.Actionable, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<Banner>;
// Properties
/**
* The label to show on the button.
*
* If set to `""` or `NULL`, the button won't be shown.
*
* The button can be used with a `GAction`, or with the
* [signal`Banner:`:button-clicked] signal.
*/
get button_label(): string;
set button_label(val: string);
/**
* The label to show on the button.
*
* If set to `""` or `NULL`, the button won't be shown.
*
* The button can be used with a `GAction`, or with the
* [signal`Banner:`:button-clicked] signal.
*/
get buttonLabel(): string;
set buttonLabel(val: string);
/**
* The style class to use for the banner button.
*
* When set to `ADW_BANNER_BUTTON_DEFAULT`, the button stays grey.
* When set to `ADW_BANNER_BUTTON_SUGGESTED`, the button follows the [`.suggested-action`](style-classes.html#suggested-action) style
*
* <picture>
* <source srcset="banner-suggested-dark.png" media="(prefers-color-scheme: dark)">
* <img src="banner-suggested.png" alt="banner with suggested button style">
* </picture>
*/
get button_style(): BannerButtonStyle;
set button_style(val: BannerButtonStyle);
/**
* The style class to use for the banner button.
*
* When set to `ADW_BANNER_BUTTON_DEFAULT`, the button stays grey.
* When set to `ADW_BANNER_BUTTON_SUGGESTED`, the button follows the [`.suggested-action`](style-classes.html#suggested-action) style
*
* <picture>
* <source srcset="banner-suggested-dark.png" media="(prefers-color-scheme: dark)">
* <img src="banner-suggested.png" alt="banner with suggested button style">
* </picture>
*/
get buttonStyle(): BannerButtonStyle;
set buttonStyle(val: BannerButtonStyle);
/**
* Whether the banner is currently revealed.
*/
get revealed(): boolean;
set revealed(val: boolean);
/**
* The title for this banner.
*
* See also: [property`Banner:`use-markup].
*/
get title(): string;
set title(val: string);
/**
* Whether to use Pango markup for the banner title.
*
* See also [func`Pango`.parse_markup].
*/
get use_markup(): boolean;
set use_markup(val: boolean);
/**
* Whether to use Pango markup for the banner title.
*
* See also [func`Pango`.parse_markup].
*/
get useMarkup(): boolean;
set useMarkup(val: boolean);
// Constructors
constructor(properties?: Partial<Banner.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](title: string): Banner;
// 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: 'button-clicked', callback: (_source: this) => void): number;
connect_after(signal: 'button-clicked', callback: (_source: this) => void): number;
emit(signal: 'button-clicked'): void;
// Methods
/**
* Gets the button label for `self`.
* @returns the button label for @self
*/
get_button_label(): string | null;
/**
* Gets the style class in use for the banner button.
* @returns the current button style
*/
get_button_style(): BannerButtonStyle;
/**
* Gets if a banner is revealed
* @returns Whether a banner is revealed
*/
get_revealed(): boolean;
/**
* Gets the title for `self`.
* @returns the title for @self
*/
get_title(): string;
/**
* Gets whether to use Pango markup for the banner title.
* @returns whether to use markup
*/
get_use_markup(): boolean;
/**
* Sets the button label for `self`.
*
* If set to `""` or `NULL`, the button won't be shown.
*
* The button can be used with a `GAction`, or with the
* [signal`Banner:`:button-clicked] signal.
* @param label the label
*/
set_button_label(label?: string | null): void;
/**
* Sets the style class to use for the banner button.
*
* When set to `ADW_BANNER_BUTTON_DEFAULT`, the button stays grey.
* When set to `ADW_BANNER_BUTTON_SUGGESTED`, the button follows the [`.suggested-action`](style-classes.html#suggested-action) style
*
* <picture>
* <source srcset="banner-suggested-dark.png" media="(prefers-color-scheme: dark)">
* <img src="banner-suggested.png" alt="banner with suggested button style">
* </picture>
* @param style a button style
*/
set_button_style(style: BannerButtonStyle | null): void;
/**
* Sets whether a banner should be revealed
* @param revealed whether a banner should be revealed
*/
set_revealed(revealed: boolean): void;
/**
* Sets the title for this banner.
*
* See also: [property`Banner:`use-markup].
* @param title the title
*/
set_title(title: string): void;
/**
* Sets whether to use Pango markup for the banner title.
*
* See also [func`Pango`.parse_markup].
* @param use_markup whether to use markup
*/
set_use_markup(use_markup: boolean): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* The name of the action with which this widget should be associated.
*/
get action_name(): string;
set action_name(val: string);
/**
* The name of the action with which this widget should be associated.
*/
get actionName(): string;
set actionName(val: string);
/**
* The target value of the actionable widget's action.
*/
get action_target(): GLib.Variant;
set action_target(val: GLib.Variant);
/**
* The target value of the actionable widget's action.
*/
get actionTarget(): GLib.Variant;
set actionTarget(val: GLib.Variant);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the action name for `actionable`.
* @returns the action name
*/
get_action_name(): string | null;
/**
* Gets the current target value of `actionable`.
* @returns the current target value
*/
get_action_target_value(): GLib.Variant | null;
/**
* Specifies the name of the action with which this widget should be
* associated.
*
* If `action_name` is %NULL then the widget will be unassociated from
* any previous action.
*
* Usually this function is used when the widget is located (or will be
* located) within the hierarchy of a `GtkApplicationWindow`.
*
* Names are of the form “win.save” or “app.quit” for actions on the
* containing [class`ApplicationWindow]` or its associated [class`Application]`,
* respectively. This is the same form used for actions in the [class`Gio`.Menu]
* associated with the window.
* @param action_name an action name
*/
set_action_name(action_name?: string | null): void;
/**
* Sets the target value of an actionable widget.
*
* If `target_value` is %NULL then the target value is unset.
*
* The target value has two purposes. First, it is used as the parameter
* to activation of the action associated with the `GtkActionable` widget.
* Second, it is used to determine if the widget should be rendered as
* “active” — the widget is active if the state is equal to the given target.
*
* Consider the example of associating a set of buttons with a [iface`Gio`.Action]
* with string state in a typical “radio button” situation. Each button
* will be associated with the same action, but with a different target
* value for that action. Clicking on a particular button will activate
* the action with the target of that button, which will typically cause
* the actions state to change to that value. Since the actions state
* is now equal to the target value of the button, the button will now
* be rendered as active (and the other buttons, with different targets,
* rendered inactive).
* @param target_value a [struct@GLib.Variant] to set as the target value
*/
set_action_target_value(target_value?: GLib.Variant | null): void;
/**
* Sets the action-name and associated string target value of an
* actionable widget.
*
* `detailed_action_name` is a string in the format accepted by
* [func`Gio`.Action.parse_detailed_name].
* @param detailed_action_name the detailed action name
*/
set_detailed_action_name(detailed_action_name: string): void;
/**
* Gets the action name for `actionable`.
*/
vfunc_get_action_name(): string | null;
/**
* Gets the current target value of `actionable`.
*/
vfunc_get_action_target_value(): GLib.Variant | null;
/**
* Specifies the name of the action with which this widget should be
* associated.
*
* If `action_name` is %NULL then the widget will be unassociated from
* any previous action.
*
* Usually this function is used when the widget is located (or will be
* located) within the hierarchy of a `GtkApplicationWindow`.
*
* Names are of the form “win.save” or “app.quit” for actions on the
* containing [class`ApplicationWindow]` or its associated [class`Application]`,
* respectively. This is the same form used for actions in the [class`Gio`.Menu]
* associated with the window.
* @param action_name an action name
*/
vfunc_set_action_name(action_name?: string | null): void;
/**
* Sets the target value of an actionable widget.
*
* If `target_value` is %NULL then the target value is unset.
*
* The target value has two purposes. First, it is used as the parameter
* to activation of the action associated with the `GtkActionable` widget.
* Second, it is used to determine if the widget should be rendered as
* “active” — the widget is active if the state is equal to the given target.
*
* Consider the example of associating a set of buttons with a [iface`Gio`.Action]
* with string state in a typical “radio button” situation. Each button
* will be associated with the same action, but with a different target
* value for that action. Clicking on a particular button will activate
* the action with the target of that button, which will typically cause
* the actions state to change to that value. Since the actions state
* is now equal to the target value of the button, the button will now
* be rendered as active (and the other buttons, with different targets,
* rendered inactive).
* @param target_value a [struct@GLib.Variant] to set as the target value
*/
vfunc_set_action_target_value(target_value?: GLib.Variant | null): void;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace Bin {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
child: Gtk.Widget;
}
}
/**
* A widget with one child.
*
* <picture>
* <source srcset="bin-dark.png" media="(prefers-color-scheme: dark)">
* <img src="bin.png" alt="bin">
* </picture>
*
* The `AdwBin` widget has only one child, set with the [property`Bin:`child]
* property.
*
* It is useful for deriving subclasses, since it provides common code needed
* for handling a single child widget.
*/
class Bin extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<Bin>;
// Properties
/**
* The child widget of the `AdwBin`.
*/
get child(): Gtk.Widget;
set child(val: Gtk.Widget);
// Constructors
constructor(properties?: Partial<Bin.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): Bin;
// Methods
/**
* Gets the child widget of `self`.
* @returns the child widget of @self
*/
get_child(): Gtk.Widget | null;
/**
* Sets the child widget of `self`.
* @param child the child widget
*/
set_child(child?: Gtk.Widget | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 BottomSheet {
// Signal callback interfaces
interface CloseAttempt {
(): void;
}
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Swipeable.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
align: number;
bottom_bar: Gtk.Widget;
bottomBar: Gtk.Widget;
bottom_bar_height: number;
bottomBarHeight: number;
can_close: boolean;
canClose: boolean;
can_open: boolean;
canOpen: boolean;
content: Gtk.Widget;
full_width: boolean;
fullWidth: boolean;
modal: boolean;
open: boolean;
reveal_bottom_bar: boolean;
revealBottomBar: boolean;
sheet: Gtk.Widget;
sheet_height: number;
sheetHeight: number;
show_drag_handle: boolean;
showDragHandle: boolean;
}
}
/**
* A bottom sheet with an optional bottom bar.
*
* <picture>
* <source srcset="bottom-sheet-dark.png" media="(prefers-color-scheme: dark)">
* <img src="bottom-sheet.png" alt="bottom-sheet">
* </picture>
*
* `AdwBottomSheet` has three child widgets. [property`BottomSheet:`content] is
* shown persistently. [property`BottomSheet:`sheet] is displayed above it when
* it's open, and [property`BottomSheet:`bottom-bar] is displayed when it's not.
*
* Bottom sheet and bottom bar are attached to the bottom edge of the widget.
* They take the full width by default, but can only take a portion of it if
* [property`BottomSheet:`full-width] is set to `FALSE`. In this case,
* [property`BottomSheet:`align] determines where along the bottom edge they are
* placed.
*
* Bottom bar can be hidden using the [property`BottomSheet:`reveal-bottom-bar]
* property.
*
* `AdwBottomSheet` can be useful for applications such as music players, that
* want to have a persistent bottom bar that expands into a bottom sheet when
* clicked. It's meant for cases where a bottom sheet is tightly integrated into
* the UI. For more transient bottom sheets, see [class`Dialog]`.
*
* To open or close the bottom sheet, use the [property`BottomSheet:`open]
* property.
*
* By default, the bottom sheet has an overlaid drag handle. It can be disabled
* by setting [property`BottomSheet:`show-drag-handle] to `FALSE`. Note that the
* handle also controls whether the sheet can be dragged using a pointer.
*
* Bottom sheets are modal by default, meaning that the content is dimmed and
* cannot be accessed while the sheet is open. Set [property`BottomSheet:`modal]
* to `FALSE` if this behavior is unwanted.
*
* To disable user interactions for opening or closing the bottom sheet (such as
* swipes or clicking the bottom bar or close button), set
* [property`BottomSheet:`can-open] or [property`BottomSheet:`can-close] to
* `FALSE`.
*
* In some cases, particularly when using a full-width bottom bar, it may be
* necessary to shift [property`BottomSheet:`content] upwards. Use the
* [property`BottomSheet:`bottom-bar-height] and
* [property`BottomSheet:`sheet-height] for that.
*
* `AdwBottomSheet` is not adaptive, and for larger window sizes applications
* may want to replace it with another UI, such as a sidebar. This can be done
* using [class`MultiLayoutView]`.
*
* ## Sizing
*
* Unlike [class`Dialog]` presented as a bottom sheet, `AdwBottomSheet` just
* follows the content's natural size, and it's up to the applications to make
* sure their content provides one. For example, when using
* [class`Gtk`.ScrolledWindow], make sure to set
* [property`Gtk`.ScrolledWindow:propagate-natural-height] to `TRUE`.
*
* ## Header Bar Integration
*
* When placed inside an `AdwBottomSheet`, [class`HeaderBar]` will not show the
* title when [property`BottomSheet:`show-drag-handle] is `TRUE`, regardless of
* [property`HeaderBar:`show-title]. This only applies to the default title,
* titles set with [property`HeaderBar:`title-widget] will still be shown.
*
* ## `AdwBottomSheet` as `GtkBuildable`:
*
* The `AdwBottomSheet` implementation of the [iface`Gtk`.Buildable] interface
* supports setting the sheet widget by specifying “sheet” as the “type”
* attribute of a `<child>` element, and the bottom bar by specifying
* “bottom-bar”. Specifying “content” or omitting the child type results in
* setting the content child.
*/
class BottomSheet extends Gtk.Widget implements Swipeable, Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<BottomSheet>;
// Properties
/**
* Horizontal alignment of the bottom sheet.
*
* 0 means the bottom sheet is flush with the start edge, 1 means it's flush
* with the end edge. 0.5 means it's centered.
*
* Only used when [property`BottomSheet:`full-width] is set to `FALSE`.
*/
get align(): number;
set align(val: number);
/**
* The bottom bar widget.
*
* Shown when [property`BottomSheet:`open] is `FALSE`. When open, morphs into
* the [property`BottomSheet:`sheet].
*
* Bottom bar can be temporarily hidden using the
* [property`BottomSheet:`reveal-bottom-bar] property.
*/
get bottom_bar(): Gtk.Widget;
set bottom_bar(val: Gtk.Widget);
/**
* The bottom bar widget.
*
* Shown when [property`BottomSheet:`open] is `FALSE`. When open, morphs into
* the [property`BottomSheet:`sheet].
*
* Bottom bar can be temporarily hidden using the
* [property`BottomSheet:`reveal-bottom-bar] property.
*/
get bottomBar(): Gtk.Widget;
set bottomBar(val: Gtk.Widget);
/**
* The current bottom bar height.
*
* It can be used to shift the content upwards permanently to accommodate for
* the bottom bar.
*/
get bottom_bar_height(): number;
/**
* The current bottom bar height.
*
* It can be used to shift the content upwards permanently to accommodate for
* the bottom bar.
*/
get bottomBarHeight(): number;
/**
* Whether the bottom sheet can be closed by user.
*
* It can be closed via the close button, swiping down, pressing
* <kbd>Escape</kbd> or clicking the content dimming (when modal).
*
* Bottom sheet can still be closed using [property`BottomSheet:`open].
*/
get can_close(): boolean;
set can_close(val: boolean);
/**
* Whether the bottom sheet can be closed by user.
*
* It can be closed via the close button, swiping down, pressing
* <kbd>Escape</kbd> or clicking the content dimming (when modal).
*
* Bottom sheet can still be closed using [property`BottomSheet:`open].
*/
get canClose(): boolean;
set canClose(val: boolean);
/**
* Whether the bottom sheet can be opened by user.
*
* It can be opened via clicking or swiping up from the bottom bar.
*
* Does nothing if [property`BottomSheet:`bottom-bar] is not set.
*
* Bottom sheet can still be opened using [property`BottomSheet:`open].
*/
get can_open(): boolean;
set can_open(val: boolean);
/**
* Whether the bottom sheet can be opened by user.
*
* It can be opened via clicking or swiping up from the bottom bar.
*
* Does nothing if [property`BottomSheet:`bottom-bar] is not set.
*
* Bottom sheet can still be opened using [property`BottomSheet:`open].
*/
get canOpen(): boolean;
set canOpen(val: boolean);
/**
* The content widget.
*
* It's always shown, and the bottom sheet is overlaid over it.
*/
get content(): Gtk.Widget;
set content(val: Gtk.Widget);
/**
* Whether the bottom sheet takes the full width.
*
* When full width, [property`BottomSheet:`align] is ignored.
*/
get full_width(): boolean;
set full_width(val: boolean);
/**
* Whether the bottom sheet takes the full width.
*
* When full width, [property`BottomSheet:`align] is ignored.
*/
get fullWidth(): boolean;
set fullWidth(val: boolean);
/**
* Whether the bottom sheet is modal.
*
* When modal, [property`BottomSheet:`content] will be dimmed when the bottom
* sheet is open, and clicking it will close the bottom sheet. It also cannot
* be focused with keyboard.
*
* Otherwise, the content is accessible even when the bottom sheet is open.
*/
get modal(): boolean;
set modal(val: boolean);
/**
* Whether the bottom sheet is open.
*/
get open(): boolean;
set open(val: boolean);
/**
* Whether to reveal the bottom bar.
*
* The transition will be animated.
*
* See [property`BottomSheet:`bottom-bar] and
* [property`BottomSheet:`bottom-bar-height].
*/
get reveal_bottom_bar(): boolean;
set reveal_bottom_bar(val: boolean);
/**
* Whether to reveal the bottom bar.
*
* The transition will be animated.
*
* See [property`BottomSheet:`bottom-bar] and
* [property`BottomSheet:`bottom-bar-height].
*/
get revealBottomBar(): boolean;
set revealBottomBar(val: boolean);
/**
* The bottom sheet widget.
*
* Only shown when [property`BottomSheet:`open] is `TRUE`.
*/
get sheet(): Gtk.Widget;
set sheet(val: Gtk.Widget);
/**
* The current bottom sheet height.
*
* It can be used to shift the content upwards when the bottom sheet is open.
*/
get sheet_height(): number;
/**
* The current bottom sheet height.
*
* It can be used to shift the content upwards when the bottom sheet is open.
*/
get sheetHeight(): number;
/**
* Whether to overlay a drag handle in the bottom sheet.
*
* The handle will be overlaid over [property`BottomSheet:`sheet].
*
* When the handle is shown, [class`HeaderBar]` will hide its default title,
* and [class`ToolbarView]` will reserve space if there are no top bars.
*
* Showing drag handle also allows to swipe the bottom sheet down (and to
* swipe the bottom bar up) with a pointer, instead of just touchscreen.
*/
get show_drag_handle(): boolean;
set show_drag_handle(val: boolean);
/**
* Whether to overlay a drag handle in the bottom sheet.
*
* The handle will be overlaid over [property`BottomSheet:`sheet].
*
* When the handle is shown, [class`HeaderBar]` will hide its default title,
* and [class`ToolbarView]` will reserve space if there are no top bars.
*
* Showing drag handle also allows to swipe the bottom sheet down (and to
* swipe the bottom bar up) with a pointer, instead of just touchscreen.
*/
get showDragHandle(): boolean;
set showDragHandle(val: boolean);
// Constructors
constructor(properties?: Partial<BottomSheet.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): BottomSheet;
// 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: 'close-attempt', callback: (_source: this) => void): number;
connect_after(signal: 'close-attempt', callback: (_source: this) => void): number;
emit(signal: 'close-attempt'): void;
// Methods
/**
* Gets horizontal alignment of the bottom sheet.
* @returns the horizontal alignment
*/
get_align(): number;
/**
* Gets the bottom bar widget for `self`.
* @returns the bottom bar widget
*/
get_bottom_bar(): Gtk.Widget | null;
/**
* Gets the current bottom bar height.
*
* It can be used to shift the content upwards permanently to accommodate for
* the bottom bar.
* @returns the bottom bar height
*/
get_bottom_bar_height(): number;
/**
* Gets whether the bottom sheet can be closed by user.
* @returns whether the sheet can be closed by user
*/
get_can_close(): boolean;
/**
* Gets whether the bottom sheet can be opened by user.
* @returns whether the sheet can be opened by user.
*/
get_can_open(): boolean;
/**
* Gets the content widget for `self`.
* @returns the content widget
*/
get_content(): Gtk.Widget | null;
/**
* Gets whether the bottom sheet takes the full width.
* @returns whether the sheet takes up the full width
*/
get_full_width(): boolean;
/**
* Gets whether the bottom sheet is modal.
* @returns whether the sheet is modal
*/
get_modal(): boolean;
/**
* Gets whether the bottom sheet is open.
* @returns whether the sheet is open
*/
get_open(): boolean;
/**
* Gets whether the bottom bar is revealed.
* @returns whether the bottom bar is revealed
*/
get_reveal_bottom_bar(): boolean;
/**
* Gets the bottom sheet widget for `self`.
* @returns the sheet widget
*/
get_sheet(): Gtk.Widget | null;
/**
* Gets the current bottom sheet height.
*
* It can be used to shift the content upwards when the bottom sheet is open.
* @returns the sheet height
*/
get_sheet_height(): number;
/**
* Gets whether to show a drag handle in the bottom sheet.
* @returns whether to show the drag handle
*/
get_show_drag_handle(): boolean;
/**
* Sets horizontal alignment of the bottom sheet.
*
* 0 means the bottom sheet is flush with the start edge, 1 means it's flush
* with the end edge. 0.5 means it's centered.
*
* Only used when [property`BottomSheet:`full-width] is set to `FALSE`.
* @param align the new alignment
*/
set_align(align: number): void;
/**
* Sets the bottom bar widget for `self`.
*
* Shown when [property`BottomSheet:`open] is `FALSE`. When open, morphs into
* the [property`BottomSheet:`sheet].
*
* Bottom bar can be temporarily hidden using the
* [property`BottomSheet:`reveal-bottom-bar] property.
* @param bottom_bar the bottom bar widget
*/
set_bottom_bar(bottom_bar?: Gtk.Widget | null): void;
/**
* Sets whether the bottom sheet can be closed by user.
*
* It can be closed via the close button, swiping down, pressing
* <kbd>Escape</kbd> or clicking the content dimming (when modal).
*
* Bottom sheet can still be closed using [property`BottomSheet:`open].
* @param can_close whether the sheet can be closed by user
*/
set_can_close(can_close: boolean): void;
/**
* Sets whether the bottom sheet can be opened by user.
*
* It can be opened via clicking or swiping up from the bottom bar.
*
* Does nothing if [property`BottomSheet:`bottom-bar] is not set.
*
* Bottom sheet can still be opened using [property`BottomSheet:`open].
* @param can_open whether the sheet can be opened by user.
*/
set_can_open(can_open: boolean): void;
/**
* Sets the content widget for `self`.
*
* It's always shown, and the bottom sheet is overlaid over it.
* @param content the content widget
*/
set_content(content?: Gtk.Widget | null): void;
/**
* Sets whether the bottom sheet takes the full width.
*
* When full width, [property`BottomSheet:`align] is ignored.
* @param full_width whether the sheet takes up the full width
*/
set_full_width(full_width: boolean): void;
/**
* Sets whether the bottom sheet is modal.
*
* When modal, [property`BottomSheet:`content] will be dimmed when the bottom
* sheet is open, and clicking it will close the bottom sheet. It also cannot be
* focused with keyboard.
*
* Otherwise, the content is accessible even when the bottom sheet is open.
* @param modal whether the sheet is modal
*/
set_modal(modal: boolean): void;
/**
* Sets whether the bottom sheet is open.
* @param open whether to open the sheet
*/
set_open(open: boolean): void;
/**
* Sets whether to reveal the bottom bar.
*
* The transition will be animated.
*
* See [property`BottomSheet:`bottom-bar] and
* [property`BottomSheet:`bottom-bar-height].
* @param reveal whether to reveal the bottom bar
*/
set_reveal_bottom_bar(reveal: boolean): void;
/**
* Sets the bottom sheet widget for `self`.
*
* Only shown when [property`BottomSheet:`open] is `TRUE`.
* @param sheet the sheet widget
*/
set_sheet(sheet?: Gtk.Widget | null): void;
/**
* Sets whether to show a drag handle in the bottom sheet.
*
* The handle will be overlaid over [property`BottomSheet:`sheet].
*
* When the handle is shown, [class`HeaderBar]` will hide its default title, and
* [class`ToolbarView]` will reserve space if there are no top bars.
*
* Showing drag handle also allows to swipe the bottom sheet down (and to swipe
* the bottom bar up) with a pointer, instead of just touchscreen.
* @param show_drag_handle whether to show the drag handle
*/
set_show_drag_handle(show_drag_handle: boolean): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// Inherited methods
/**
* Gets the progress `self` will snap back to after the gesture is canceled.
* @returns the cancel progress, unitless
*/
get_cancel_progress(): number;
/**
* Gets the swipe distance of `self`.
*
* This corresponds to how many pixels 1 unit represents.
* @returns the swipe distance in pixels
*/
get_distance(): number;
/**
* Gets the current progress of `self`.
* @returns the current progress, unitless
*/
get_progress(): number;
/**
* Gets the snap points of `self`.
*
* Each snap point represents a progress value that is considered acceptable to
* end the swipe on.
* @returns the snap points
*/
get_snap_points(): number[];
/**
* Gets the area `self` can start a swipe from for the given direction and
* gesture type.
*
* This can be used to restrict swipes to only be possible from a certain area,
* for example, to only allow edge swipes, or to have a draggable element and
* ignore swipes elsewhere.
*
* If not implemented, the default implementation returns the allocation of
* `self,` allowing swipes from anywhere.
* @param navigation_direction the direction of the swipe
* @param is_drag whether the swipe is caused by a dragging gesture
*/
get_swipe_area(navigation_direction: NavigationDirection | null, is_drag: boolean): Gdk.Rectangle;
/**
* Gets the progress `self` will snap back to after the gesture is canceled.
*/
vfunc_get_cancel_progress(): number;
/**
* Gets the swipe distance of `self`.
*
* This corresponds to how many pixels 1 unit represents.
*/
vfunc_get_distance(): number;
/**
* Gets the current progress of `self`.
*/
vfunc_get_progress(): number;
/**
* Gets the snap points of `self`.
*
* Each snap point represents a progress value that is considered acceptable to
* end the swipe on.
*/
vfunc_get_snap_points(): number[];
/**
* Gets the area `self` can start a swipe from for the given direction and
* gesture type.
*
* This can be used to restrict swipes to only be possible from a certain area,
* for example, to only allow edge swipes, or to have a draggable element and
* ignore swipes elsewhere.
*
* If not implemented, the default implementation returns the allocation of
* `self,` allowing swipes from anywhere.
* @param navigation_direction the direction of the swipe
* @param is_drag whether the swipe is caused by a dragging gesture
*/
vfunc_get_swipe_area(navigation_direction: NavigationDirection, is_drag: boolean): Gdk.Rectangle;
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: string): void;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): 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 Breakpoint {
// Signal callback interfaces
interface Apply {
(): void;
}
interface Unapply {
(): void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, Gtk.Buildable.ConstructorProps {
condition: BreakpointCondition;
}
}
/**
* Describes a breakpoint for [class`Window]` or [class`Dialog]`.
*
* Breakpoints are used to create adaptive UI, allowing to change the layout
* depending on available size.
*
* Breakpoint is a size threshold, specified by its condition, as well as one or
* more setters.
*
* Each setter has a target object, a property and a value. When a breakpoint
* is applied, each setter sets the target property on their target object to
* the specified value, and reset it back to the original value when it's
* unapplied.
*
* For more complicated scenarios, [signal`Breakpoint:`:apply] and
* [signal`Breakpoint:`:unapply] can be used instead.
*
* Breakpoints can be used within [class`Window]`, [class`ApplicationWindow]`,
* [class`Dialog]` or [class`BreakpointBin]`.
*
* ## `AdwBreakpoint` as `GtkBuildable`:
*
* `AdwBreakpoint` supports specifying its condition via the `<condition>`
* element. The contents of the element must be a string in a format accepted by
* [func`BreakpointCondition`.parse].
*
* It also supports adding setters via the `<setter>` element. Each `<setter>`
* element must have the `object` attribute specifying the target object, and
* the `property` attribute specifying the property name. The contents of the
* element are used as the setter value.
*
* For `G_TYPE_OBJECT` and `G_TYPE_BOXED` derived properties, empty contents are
* treated as `NULL`.
*
* Setter values can be translated with the usual `translatable`, `context` and
* `comments` attributes.
*
* Example of an `AdwBreakpoint` UI definition:
*
* ```xml
* <object class="AdwBreakpoint">
* <condition>max-width: 400px</condition>
* <setter object="button" property="visible">True</setter>
* <setter object="box" property="orientation">vertical</setter>
* <setter object="page" property="title" translatable="yes">Example</setter>
* </object>
* ```
*/
class Breakpoint extends GObject.Object implements Gtk.Buildable {
static $gtype: GObject.GType<Breakpoint>;
// Properties
/**
* The breakpoint's condition.
*/
get condition(): BreakpointCondition;
set condition(val: BreakpointCondition);
// Constructors
constructor(properties?: Partial<Breakpoint.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](condition: BreakpointCondition): Breakpoint;
// 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: 'apply', callback: (_source: this) => void): number;
connect_after(signal: 'apply', callback: (_source: this) => void): number;
emit(signal: 'apply'): void;
connect(signal: 'unapply', callback: (_source: this) => void): number;
connect_after(signal: 'unapply', callback: (_source: this) => void): number;
emit(signal: 'unapply'): void;
// Methods
/**
* Adds a setter to `self`.
*
* The setter will automatically set `property` on `object` to `value` when
* applying the breakpoint, and set it back to its original value upon
* unapplying it.
*
* ::: note
* Setting properties to their original values does not work for properties
* that have irreversible side effects. For example, changing
* [property`Gtk`.Button:label] while [property`Gtk`.Button:icon-name] is set
* will reset the icon. However, resetting the label will not set
* `icon-name` to its original value.
*
* Use the [signal`Breakpoint:`:apply] and [signal`Breakpoint:`:unapply] signals
* for those properties instead, as follows:
*
* ```c
* static void
* breakpoint_apply_cb (MyWidget *self)
* {
* gtk_button_set_icon_name (self->button, "go-previous-symbolic");
* }
*
* static void
* breakpoint_apply_cb (MyWidget *self)
* {
* gtk_button_set_label (self->button, _("_Back"));
* }
*
* // ...
*
* g_signal_connect_swapped (breakpoint, "apply",
* G_CALLBACK (breakpoint_apply_cb), self);
* g_signal_connect_swapped (breakpoint, "unapply",
* G_CALLBACK (breakpoint_unapply_cb), self);
* ```
* @param object the target object
* @param property the target property
* @param value the value to set
*/
add_setter(object: GObject.Object, property: string, value?: GObject.Value | null): void;
/**
* Adds `n_setters` setters to `self`.
*
* This is a convenience function for adding multiple setters at once.
*
* See [method`Breakpoint`.add_setter].
*
* This function is meant to be used by language bindings.
* @param objects setter target object
* @param names setter target properties
* @param values setter values
*/
add_setters(objects: GObject.Object[], names: string[], values: (GObject.Value | any)[]): void;
/**
* Gets the condition for `self`.
* @returns the condition
*/
get_condition(): BreakpointCondition | null;
/**
* Sets the condition for `self`.
* @param condition the new condition
*/
set_condition(condition?: BreakpointCondition | null): void;
// Inherited methods
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 BreakpointBin {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
child: Gtk.Widget;
current_breakpoint: Breakpoint;
currentBreakpoint: Breakpoint;
}
}
/**
* A widget that changes layout based on available size.
*
* <picture>
* <source srcset="breakpoint-bin-dark.png" media="(prefers-color-scheme: dark)">
* <img src="breakpoint-bin.png" alt="breakpoint-bin">
* </picture>
*
* `AdwBreakpointBin` provides a way to use breakpoints without [class`Window]`,
* [class`ApplicationWindow]` or [class`Dialog]`. It can be useful for limiting
* breakpoints to a single page and similar purposes. Most applications
* shouldn't need it.
*
* `AdwBreakpointBin` is similar to [class`Bin]`. It has one child, set via the
* [property`BreakpointBin:`child] property.
*
* When `AdwBreakpointBin` is resized, its child widget can rearrange its layout
* at specific thresholds.
*
* The thresholds and layout changes are defined via [class`Breakpoint]` objects.
* They can be added using [method`BreakpointBin`.add_breakpoint].
*
* Each breakpoint has a condition, specifying the bin's size and/or aspect
* ratio, and setters that automatically set object properties when that
* happens. The [signal`Breakpoint:`:apply] and [signal`Breakpoint:`:unapply] can
* be used instead for more complex scenarios.
*
* Breakpoints are only allowed to modify widgets inside the `AdwBreakpointBin`,
* but not on the `AdwBreakpointBin` itself or any other widgets.
*
* If multiple breakpoints can be used for the current size, the last one is
* always picked. The current breakpoint can be tracked using the
* [property`BreakpointBin:`current-breakpoint] property.
*
* If none of the breakpoints can be used, that property will be set to `NULL`,
* and the original property values will be used instead.
*
* ## Minimum Size
*
* Adding a breakpoint to `AdwBreakpointBin` will result in it having no minimum
* size. The [property`Gtk`.Widget:width-request] and
* [property`Gtk`.Widget:height-request] properties must always be set when using
* breakpoints, indicating the smallest size you want to support.
*
* The minimum size and breakpoint conditions must be carefully selected so that
* the child widget completely fits. If it doesn't, it will overflow and a
* warning message will be printed.
*
* When choosing minimum size, consider translations and text scale factor
* changes. Make sure to leave enough space for text labels, and enable
* ellipsizing or wrapping if they might not fit.
*
* For [class`Gtk`.Label] this can be done via [property`Gtk`.Label:ellipsize], or
* via [property`Gtk`.Label:wrap] together with [property`Gtk`.Label:wrap-mode].
*
* For buttons, use [property`Gtk`.Button:can-shrink],
* [property`Gtk`.MenuButton:can-shrink], [property`Adw`.SplitButton:can-shrink],
* or [property`Adw`.ButtonContent:can-shrink].
*
* ## Example
*
* ```c
* GtkWidget *bin, *child;
* AdwBreakpoint *breakpoint;
*
* bin = adw_breakpoint_bin_new ();
* gtk_widget_set_size_request (bin, 150, 150);
*
* child = gtk_label_new ("Wide");
* gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
* gtk_widget_add_css_class (child, "title-1");
* adw_breakpoint_bin_set_child (ADW_BREAKPOINT_BIN (bin), child);
*
* breakpoint = adw_breakpoint_new (adw_breakpoint_condition_parse ("max-width: 200px"));
* adw_breakpoint_add_setters (breakpoint,
* G_OBJECT (child), "label", "Narrow",
* NULL);
* adw_breakpoint_bin_add_breakpoint (ADW_BREAKPOINT_BIN (bin), breakpoint);
* ```
*
* The bin has a single label inside it, displaying "Wide". When the bin's width
* is smaller than or equal to 200px, it changes to "Narrow".
*
* ## `AdwBreakpointBin` as `GtkBuildable`
*
* `AdwBreakpointBin` allows adding `AdwBreakpoint` objects as children.
*
* Example of an `AdwBreakpointBin` UI definition:
*
* ```xml
* <object class="AdwBreakpointBin">
* <property name="width-request">150</property>
* <property name="height-request">150</property>
* <property name="child">
* <object class="GtkLabel" id="child">
* <property name="label">Wide</property>
* <property name="ellipsize">end</property>
* <style>
* <class name="title-1"/>
* </style>
* </object>
* </property>
* <child>
* <object class="AdwBreakpoint">
* <condition>max-width: 200px</condition>
* <setter object="child" property="label">Narrow</setter>
* </object>
* </child>
* </object>
* ```
*
* See [class`Breakpoint]` documentation for details.
*/
class BreakpointBin extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<BreakpointBin>;
// Properties
/**
* The child widget.
*/
get child(): Gtk.Widget;
set child(val: Gtk.Widget);
/**
* The current breakpoint.
*/
get current_breakpoint(): Breakpoint;
/**
* The current breakpoint.
*/
get currentBreakpoint(): Breakpoint;
// Constructors
constructor(properties?: Partial<BreakpointBin.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): BreakpointBin;
// Methods
/**
* Adds `breakpoint` to `self`.
* @param breakpoint the breakpoint to add
*/
add_breakpoint(breakpoint: Breakpoint): void;
/**
* Gets the child widget of `self`.
* @returns the child widget of @self
*/
get_child(): Gtk.Widget | null;
/**
* Gets the current breakpoint.
* @returns the current breakpoint
*/
get_current_breakpoint(): Breakpoint | null;
/**
* Removes `breakpoint` from `self`.
* @param breakpoint a breakpoint to remove
*/
remove_breakpoint(breakpoint: Breakpoint): void;
/**
* Sets the child widget of `self`.
* @param child the child widget
*/
set_child(child?: Gtk.Widget | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 ButtonContent {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
can_shrink: boolean;
canShrink: boolean;
icon_name: string;
iconName: string;
label: string;
use_underline: boolean;
useUnderline: boolean;
}
}
/**
* A helper widget for creating buttons.
*
* <picture>
* <source srcset="button-content-dark.png" media="(prefers-color-scheme: dark)">
* <img src="button-content.png" alt="button-content">
* </picture>
*
* `AdwButtonContent` is a box-like widget with an icon and a label.
*
* It's intended to be used as a direct child of [class`Gtk`.Button],
* [class`Gtk`.MenuButton] or [class`SplitButton]`, when they need to have both an
* icon and a label, as follows:
*
* ```xml
* <object class="GtkButton">
* <property name="child">
* <object class="AdwButtonContent">
* <property name="icon-name">document-open-symbolic</property>
* <property name="label" translatable="yes">_Open</property>
* <property name="use-underline">True</property>
* </object>
* </property>
* </object>
* ```
*
* `AdwButtonContent` handles style classes and connecting the mnemonic to the
* button automatically.
*
* ## CSS nodes
*
* ```
* buttoncontent
* ╰── box
* ├── image
* ╰── label
* ```
*
* `AdwButtonContent`'s CSS node is called `buttoncontent`. It contains a `box`
* subnode that serves as a container for the `image` and `label` nodes.
*
* When inside a `GtkButton` or `AdwSplitButton`, the button will receive the
* `.image-text-button` style class. When inside a `GtkMenuButton`, the
* internal `GtkButton` will receive it instead.
*
* ## Accessibility
*
* `AdwButtonContent` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.
*/
class ButtonContent extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<ButtonContent>;
// Properties
/**
* Whether the button can be smaller than the natural size of its contents.
*
* If set to `TRUE`, the label will ellipsize.
*
* See [property`Gtk`.Button:can-shrink].
*/
get can_shrink(): boolean;
set can_shrink(val: boolean);
/**
* Whether the button can be smaller than the natural size of its contents.
*
* If set to `TRUE`, the label will ellipsize.
*
* See [property`Gtk`.Button:can-shrink].
*/
get canShrink(): boolean;
set canShrink(val: boolean);
/**
* The name of the displayed icon.
*
* If empty, the icon is not shown.
*/
get icon_name(): string;
set icon_name(val: string);
/**
* The name of the displayed icon.
*
* If empty, the icon is not shown.
*/
get iconName(): string;
set iconName(val: string);
/**
* The displayed label.
*/
get label(): string;
set label(val: string);
/**
* Whether an underline in the text indicates a mnemonic.
*
* The mnemonic can be used to activate the parent button.
*
* See [property`ButtonContent:`label].
*/
get use_underline(): boolean;
set use_underline(val: boolean);
/**
* Whether an underline in the text indicates a mnemonic.
*
* The mnemonic can be used to activate the parent button.
*
* See [property`ButtonContent:`label].
*/
get useUnderline(): boolean;
set useUnderline(val: boolean);
// Constructors
constructor(properties?: Partial<ButtonContent.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): ButtonContent;
// Methods
/**
* gets whether the button can be smaller than the natural size of its contents.
* @returns whether the button can shrink
*/
get_can_shrink(): boolean;
/**
* Gets the name of the displayed icon.
* @returns the icon name
*/
get_icon_name(): string;
/**
* Gets the displayed label.
* @returns the label
*/
get_label(): string;
/**
* Gets whether an underline in the text indicates a mnemonic.
* @returns whether an underline in the text indicates a mnemonic
*/
get_use_underline(): boolean;
/**
* Sets whether the button can be smaller than the natural size of its contents.
*
* If set to `TRUE`, the label will ellipsize.
*
* See [method`Gtk`.Button.set_can_shrink].
* @param can_shrink whether the button can shrink
*/
set_can_shrink(can_shrink: boolean): void;
/**
* Sets the name of the displayed icon.
*
* If empty, the icon is not shown.
* @param icon_name the new icon name
*/
set_icon_name(icon_name: string): void;
/**
* Sets the displayed label.
* @param label the new label
*/
set_label(label: string): void;
/**
* Sets whether an underline in the text indicates a mnemonic.
*
* The mnemonic can be used to activate the parent button.
*
* See [property`ButtonContent:`label].
* @param use_underline whether an underline in the text indicates a mnemonic
*/
set_use_underline(use_underline: boolean): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 ButtonRow {
// Signal callback interfaces
interface Activated {
(): void;
}
// Constructor properties interface
interface ConstructorProps
extends PreferencesRow.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Actionable.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
end_icon_name: string;
endIconName: string;
start_icon_name: string;
startIconName: string;
}
}
/**
* A [class`Gtk`.ListBoxRow] that looks like a button.
*
* <picture>
* <source srcset="button-rows-dark.png" media="(prefers-color-scheme: dark)">
* <img src="button-rows.png" alt="button-rows">
* </picture>
*
* The `AdwButtonRow` widget has a title and two icons: before and after the
* title.
*
* It is convenient for presenting actions like "Delete" at the end of a boxed
* list.
*
* `AdwButtonRow` is always activatable.
*
* ## CSS nodes
*
* `AdwButtonRow` has a main CSS node with name `row` and the style class
* `.button`.
*
* It contains the subnode `box` for its main horizontal box, which contains the
* nodes: `image.icon.start` for the start icon, `label.title` for the title,
* and `image.icon.end` for the end icon.
*
* ## Style classes
*
* The [`.suggested-action`](style-classes.html#suggested-action) style class
* makes `AdwButtonRow` use accent color for its background. It should be used
* very sparingly to denote important buttons.
*
* <picture>
* <source srcset="button-row-suggested-action-dark.png" media="(prefers-color-scheme: dark)">
* <img src="button-row-suggested-action.png" alt="button-row-suggested-action">
* </picture>
*
* The [`.destructive-action`](style-classes.html#destructive-action) style
* makes the row use destructive colors. It can be used to draw attention to the
* potentially damaging consequences of using it. This style acts as a warning
* to the user.
*
* <picture>
* <source srcset="button-row-destructive-action-dark.png" media="(prefers-color-scheme: dark)">
* <img src="button-row-destructive-action.png" alt="button-row-destructive-action">
* </picture>
*/
class ButtonRow
extends PreferencesRow
implements Gtk.Accessible, Gtk.Actionable, Gtk.Buildable, Gtk.ConstraintTarget
{
static $gtype: GObject.GType<ButtonRow>;
// Properties
/**
* The icon name to show after the title.
*/
get end_icon_name(): string;
set end_icon_name(val: string);
/**
* The icon name to show after the title.
*/
get endIconName(): string;
set endIconName(val: string);
/**
* The icon name to show before the title.
*/
get start_icon_name(): string;
set start_icon_name(val: string);
/**
* The icon name to show before the title.
*/
get startIconName(): string;
set startIconName(val: string);
// Constructors
constructor(properties?: Partial<ButtonRow.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): ButtonRow;
// 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: 'activated', callback: (_source: this) => void): number;
connect_after(signal: 'activated', callback: (_source: this) => void): number;
emit(signal: 'activated'): void;
// Methods
/**
* Gets the end icon name for `self`.
* @returns the end icon name for @self
*/
get_end_icon_name(): string | null;
/**
* Gets the start icon name for `self`.
* @returns the start icon name for @self
*/
get_start_icon_name(): string | null;
/**
* Sets the end icon name for `self`.
* @param icon_name the end icon name
*/
set_end_icon_name(icon_name?: string | null): void;
/**
* Sets the start icon name for `self`.
* @param icon_name the start icon name
*/
set_start_icon_name(icon_name?: string | null): void;
// Inherited properties
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// 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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace CallbackAnimationTarget {
// Constructor properties interface
interface ConstructorProps extends AnimationTarget.ConstructorProps {}
}
/**
* An [class`AnimationTarget]` that calls a given callback during the
* animation.
*/
class CallbackAnimationTarget extends AnimationTarget {
static $gtype: GObject.GType<CallbackAnimationTarget>;
// Constructors
constructor(properties?: Partial<CallbackAnimationTarget.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](callback: AnimationTargetFunc): CallbackAnimationTarget;
}
namespace Carousel {
// Signal callback interfaces
interface PageChanged {
(index: number): void;
}
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Swipeable.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Orientable.ConstructorProps {
allow_long_swipes: boolean;
allowLongSwipes: boolean;
allow_mouse_drag: boolean;
allowMouseDrag: boolean;
allow_scroll_wheel: boolean;
allowScrollWheel: boolean;
interactive: boolean;
n_pages: number;
nPages: number;
position: number;
reveal_duration: number;
revealDuration: number;
scroll_params: SpringParams;
scrollParams: SpringParams;
spacing: number;
}
}
/**
* A paginated scrolling widget.
*
* <picture>
* <source srcset="carousel-dark.png" media="(prefers-color-scheme: dark)">
* <img src="carousel.png" alt="carousel">
* </picture>
*
* The `AdwCarousel` widget can be used to display a set of pages with
* swipe-based navigation between them.
*
* [class`CarouselIndicatorDots]` and [class`CarouselIndicatorLines]` can be used
* to provide page indicators for `AdwCarousel`.
*
* ## CSS nodes
*
* `AdwCarousel` has a single CSS node with name `carousel`.
*/
class Carousel
extends Gtk.Widget
implements Swipeable, Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Orientable
{
static $gtype: GObject.GType<Carousel>;
// Properties
/**
* Whether to allow swiping for more than one page at a time.
*
* If the value is `FALSE`, each swipe can only move to the adjacent pages.
*/
get allow_long_swipes(): boolean;
set allow_long_swipes(val: boolean);
/**
* Whether to allow swiping for more than one page at a time.
*
* If the value is `FALSE`, each swipe can only move to the adjacent pages.
*/
get allowLongSwipes(): boolean;
set allowLongSwipes(val: boolean);
/**
* Sets whether the `AdwCarousel` can be dragged with mouse pointer.
*
* If the value is `FALSE`, dragging is only available on touch.
*/
get allow_mouse_drag(): boolean;
set allow_mouse_drag(val: boolean);
/**
* Sets whether the `AdwCarousel` can be dragged with mouse pointer.
*
* If the value is `FALSE`, dragging is only available on touch.
*/
get allowMouseDrag(): boolean;
set allowMouseDrag(val: boolean);
/**
* Whether the widget will respond to scroll wheel events.
*
* If the value is `FALSE`, wheel events will be ignored.
*/
get allow_scroll_wheel(): boolean;
set allow_scroll_wheel(val: boolean);
/**
* Whether the widget will respond to scroll wheel events.
*
* If the value is `FALSE`, wheel events will be ignored.
*/
get allowScrollWheel(): boolean;
set allowScrollWheel(val: boolean);
/**
* Whether the carousel can be navigated.
*
* This can be used to temporarily disable the carousel to only allow
* navigating it in a certain state.
*/
get interactive(): boolean;
set interactive(val: boolean);
/**
* The number of pages in a `AdwCarousel`.
*/
get n_pages(): number;
/**
* The number of pages in a `AdwCarousel`.
*/
get nPages(): number;
/**
* Current scrolling position, unitless.
*
* 1 matches 1 page. Use [method`Carousel`.scroll_to] for changing it.
*/
get position(): number;
/**
* Page reveal duration, in milliseconds.
*
* Reveal duration is used when animating adding or removing pages.
*/
get reveal_duration(): number;
set reveal_duration(val: number);
/**
* Page reveal duration, in milliseconds.
*
* Reveal duration is used when animating adding or removing pages.
*/
get revealDuration(): number;
set revealDuration(val: number);
/**
* Scroll animation spring parameters.
*
* The default value is equivalent to:
*
* ```c
* adw_spring_params_new (1, 0.5, 500)
* ```
*/
get scroll_params(): SpringParams;
set scroll_params(val: SpringParams);
/**
* Scroll animation spring parameters.
*
* The default value is equivalent to:
*
* ```c
* adw_spring_params_new (1, 0.5, 500)
* ```
*/
get scrollParams(): SpringParams;
set scrollParams(val: SpringParams);
/**
* Spacing between pages in pixels.
*/
get spacing(): number;
set spacing(val: number);
// Constructors
constructor(properties?: Partial<Carousel.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): Carousel;
// 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: 'page-changed', callback: (_source: this, index: number) => void): number;
connect_after(signal: 'page-changed', callback: (_source: this, index: number) => void): number;
emit(signal: 'page-changed', index: number): void;
// Methods
/**
* Appends `child` to `self`.
* @param child a widget to add
*/
append(child: Gtk.Widget): void;
/**
* Gets whether to allow swiping for more than one page at a time.
* @returns `TRUE` if long swipes are allowed
*/
get_allow_long_swipes(): boolean;
/**
* Sets whether `self` can be dragged with mouse pointer.
* @returns whether @self can be dragged with mouse pointer
*/
get_allow_mouse_drag(): boolean;
/**
* Gets whether `self` will respond to scroll wheel events.
* @returns `TRUE` if @self will respond to scroll wheel events
*/
get_allow_scroll_wheel(): boolean;
/**
* Gets whether `self` can be navigated.
* @returns whether @self can be navigated
*/
get_interactive(): boolean;
/**
* Gets the number of pages in `self`.
* @returns the number of pages in @self
*/
get_n_pages(): number;
/**
* Gets the page at position `n`.
* @param n index of the page
* @returns the page
*/
get_nth_page(n: number): Gtk.Widget;
/**
* Gets current scroll position in `self,` unitless.
*
* 1 matches 1 page. Use [method`Carousel`.scroll_to] for changing it.
* @returns the scroll position
*/
get_position(): number;
/**
* Gets the page reveal duration, in milliseconds.
* @returns the duration
*/
get_reveal_duration(): number;
/**
* Gets the scroll animation spring parameters for `self`.
* @returns the animation parameters
*/
get_scroll_params(): SpringParams;
/**
* Gets spacing between pages in pixels.
* @returns spacing between pages
*/
get_spacing(): number;
/**
* Inserts `child` into `self` at position `position`.
*
* If position is -1, or larger than the number of pages,
* `child` will be appended to the end.
* @param child a widget to add
* @param position the position to insert @child at
*/
insert(child: Gtk.Widget, position: number): void;
/**
* Prepends `child` to `self`.
* @param child a widget to add
*/
prepend(child: Gtk.Widget): void;
/**
* Removes `child` from `self`.
* @param child a widget to remove
*/
remove(child: Gtk.Widget): void;
/**
* Moves `child` into position `position`.
*
* If position is -1, or larger than the number of pages, `child` will be moved
* at the end.
* @param child a widget to add
* @param position the position to move @child to
*/
reorder(child: Gtk.Widget, position: number): void;
/**
* Scrolls to `widget`.
*
* If `animate` is `TRUE`, the transition will be animated.
* @param widget a child of @self
* @param animate whether to animate the transition
*/
scroll_to(widget: Gtk.Widget, animate: boolean): void;
/**
* Sets whether to allow swiping for more than one page at a time.
*
* If `allow_long_swipes` is `FALSE`, each swipe can only move to the adjacent
* pages.
* @param allow_long_swipes whether to allow long swipes
*/
set_allow_long_swipes(allow_long_swipes: boolean): void;
/**
* Sets whether `self` can be dragged with mouse pointer.
*
* If `allow_mouse_drag` is `FALSE`, dragging is only available on touch.
* @param allow_mouse_drag whether @self can be dragged with mouse pointer
*/
set_allow_mouse_drag(allow_mouse_drag: boolean): void;
/**
* Sets whether `self` will respond to scroll wheel events.
*
* If `allow_scroll_wheel` is `FALSE`, wheel events will be ignored.
* @param allow_scroll_wheel whether @self will respond to scroll wheel events
*/
set_allow_scroll_wheel(allow_scroll_wheel: boolean): void;
/**
* Sets whether `self` can be navigated.
*
* This can be used to temporarily disable the carousel to only allow navigating
* it in a certain state.
* @param interactive whether @self can be navigated
*/
set_interactive(interactive: boolean): void;
/**
* Sets the page reveal duration, in milliseconds.
*
* Reveal duration is used when animating adding or removing pages.
* @param reveal_duration the new reveal duration value
*/
set_reveal_duration(reveal_duration: number): void;
/**
* Sets the scroll animation spring parameters for `self`.
*
* The default value is equivalent to:
*
* ```c
* adw_spring_params_new (1, 0.5, 500)
* ```
* @param params the new parameters
*/
set_scroll_params(params: SpringParams): void;
/**
* Sets spacing between pages in pixels.
* @param spacing the new spacing value
*/
set_spacing(spacing: number): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* The orientation of the orientable.
*/
get orientation(): Gtk.Orientation;
set orientation(val: Gtk.Orientation);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// Inherited methods
/**
* Gets the progress `self` will snap back to after the gesture is canceled.
* @returns the cancel progress, unitless
*/
get_cancel_progress(): number;
/**
* Gets the swipe distance of `self`.
*
* This corresponds to how many pixels 1 unit represents.
* @returns the swipe distance in pixels
*/
get_distance(): number;
/**
* Gets the current progress of `self`.
* @returns the current progress, unitless
*/
get_progress(): number;
/**
* Gets the snap points of `self`.
*
* Each snap point represents a progress value that is considered acceptable to
* end the swipe on.
* @returns the snap points
*/
get_snap_points(): number[];
/**
* Gets the area `self` can start a swipe from for the given direction and
* gesture type.
*
* This can be used to restrict swipes to only be possible from a certain area,
* for example, to only allow edge swipes, or to have a draggable element and
* ignore swipes elsewhere.
*
* If not implemented, the default implementation returns the allocation of
* `self,` allowing swipes from anywhere.
* @param navigation_direction the direction of the swipe
* @param is_drag whether the swipe is caused by a dragging gesture
*/
get_swipe_area(navigation_direction: NavigationDirection | null, is_drag: boolean): Gdk.Rectangle;
/**
* Gets the progress `self` will snap back to after the gesture is canceled.
*/
vfunc_get_cancel_progress(): number;
/**
* Gets the swipe distance of `self`.
*
* This corresponds to how many pixels 1 unit represents.
*/
vfunc_get_distance(): number;
/**
* Gets the current progress of `self`.
*/
vfunc_get_progress(): number;
/**
* Gets the snap points of `self`.
*
* Each snap point represents a progress value that is considered acceptable to
* end the swipe on.
*/
vfunc_get_snap_points(): number[];
/**
* Gets the area `self` can start a swipe from for the given direction and
* gesture type.
*
* This can be used to restrict swipes to only be possible from a certain area,
* for example, to only allow edge swipes, or to have a draggable element and
* ignore swipes elsewhere.
*
* If not implemented, the default implementation returns the allocation of
* `self,` allowing swipes from anywhere.
* @param navigation_direction the direction of the swipe
* @param is_drag whether the swipe is caused by a dragging gesture
*/
vfunc_get_swipe_area(navigation_direction: NavigationDirection, is_drag: boolean): Gdk.Rectangle;
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: string): void;
/**
* Retrieves the orientation of the `orientable`.
* @returns the orientation of the @orientable
*/
get_orientation(): Gtk.Orientation;
/**
* Sets the orientation of the `orientable`.
* @param orientation the orientables new orientation
*/
set_orientation(orientation: Gtk.Orientation | null): void;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): 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 CarouselIndicatorDots {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Orientable.ConstructorProps {
carousel: Carousel;
}
}
/**
* A dots indicator for [class`Carousel]`.
*
* <picture>
* <source srcset="carousel-indicator-dots-dark.png" media="(prefers-color-scheme: dark)">
* <img src="carousel-indicator-dots.png" alt="carousel-indicator-dots">
* </picture>
*
* The `AdwCarouselIndicatorDots` widget shows a set of dots for each page of a
* given [class`Carousel]`. The dot representing the carousel's active page is
* larger and more opaque than the others, the transition to the active and
* inactive state is gradual to match the carousel's position.
*
* See also [class`CarouselIndicatorLines]`.
*
* ## CSS nodes
*
* `AdwCarouselIndicatorDots` has a single CSS node with name
* `carouselindicatordots`.
*/
class CarouselIndicatorDots
extends Gtk.Widget
implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Orientable
{
static $gtype: GObject.GType<CarouselIndicatorDots>;
// Properties
/**
* The displayed carousel.
*/
get carousel(): Carousel;
set carousel(val: Carousel);
// Constructors
constructor(properties?: Partial<CarouselIndicatorDots.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): CarouselIndicatorDots;
// Methods
/**
* Gets the displayed carousel.
* @returns the displayed carousel
*/
get_carousel(): Carousel | null;
/**
* Sets the displayed carousel.
* @param carousel a carousel
*/
set_carousel(carousel?: Carousel | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* The orientation of the orientable.
*/
get orientation(): Gtk.Orientation;
set orientation(val: Gtk.Orientation);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: string): void;
/**
* Retrieves the orientation of the `orientable`.
* @returns the orientation of the @orientable
*/
get_orientation(): Gtk.Orientation;
/**
* Sets the orientation of the `orientable`.
* @param orientation the orientables new orientation
*/
set_orientation(orientation: Gtk.Orientation | null): 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 CarouselIndicatorLines {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Orientable.ConstructorProps {
carousel: Carousel;
}
}
/**
* A lines indicator for [class`Carousel]`.
*
* <picture>
* <source srcset="carousel-indicator-dots-lines.png" media="(prefers-color-scheme: dark)">
* <img src="carousel-indicator-lines.png" alt="carousel-indicator-lines">
* </picture>
*
* The `AdwCarouselIndicatorLines` widget shows a set of lines for each page of
* a given [class`Carousel]`. The carousel's active page is shown as another line
* that moves between them to match the carousel's position.
*
* See also [class`CarouselIndicatorDots]`.
*
* ## CSS nodes
*
* `AdwCarouselIndicatorLines` has a single CSS node with name
* `carouselindicatorlines`.
*/
class CarouselIndicatorLines
extends Gtk.Widget
implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Orientable
{
static $gtype: GObject.GType<CarouselIndicatorLines>;
// Properties
/**
* The displayed carousel.
*/
get carousel(): Carousel;
set carousel(val: Carousel);
// Constructors
constructor(properties?: Partial<CarouselIndicatorLines.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): CarouselIndicatorLines;
// Methods
/**
* Gets the displayed carousel.
* @returns the displayed carousel
*/
get_carousel(): Carousel | null;
/**
* Sets the displayed carousel.
* @param carousel a carousel
*/
set_carousel(carousel?: Carousel | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* The orientation of the orientable.
*/
get orientation(): Gtk.Orientation;
set orientation(val: Gtk.Orientation);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: string): void;
/**
* Retrieves the orientation of the `orientable`.
* @returns the orientation of the @orientable
*/
get_orientation(): Gtk.Orientation;
/**
* Sets the orientation of the `orientable`.
* @param orientation the orientables new orientation
*/
set_orientation(orientation: Gtk.Orientation | null): 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 Clamp {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Orientable.ConstructorProps {
child: Gtk.Widget;
maximum_size: number;
maximumSize: number;
tightening_threshold: number;
tighteningThreshold: number;
unit: LengthUnit;
}
}
/**
* A widget constraining its child to a given size.
*
* <picture>
* <source srcset="clamp-wide-dark.png" media="(prefers-color-scheme: dark)">
* <img src="clamp-wide.png" alt="clamp-wide">
* </picture>
* <picture>
* <source srcset="clamp-narrow-dark.png" media="(prefers-color-scheme: dark)">
* <img src="clamp-narrow.png" alt="clamp-narrow">
* </picture>
*
* The `AdwClamp` widget constrains the size of the widget it contains to a
* given maximum size. It will constrain the width if it is horizontal, or the
* height if it is vertical. The expansion of the child from its minimum to its
* maximum size is eased out for a smooth transition.
*
* If the child requires more than the requested maximum size, it will be
* allocated the minimum size it can fit in instead.
*
* `AdwClamp` can scale with the text scale factor, use the
* [property`Clamp:`unit] property to enable that behavior.
*
* See also: [class`ClampLayout]`, [class`ClampScrollable]`.
*
* ## CSS nodes
*
* `AdwClamp` has a single CSS node with name `clamp`.
*/
class Clamp extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Orientable {
static $gtype: GObject.GType<Clamp>;
// Properties
/**
* The child widget of the `AdwClamp`.
*/
get child(): Gtk.Widget;
set child(val: Gtk.Widget);
/**
* The maximum size allocated to the child.
*
* It is the width if the clamp is horizontal, or the height if it is vertical.
*/
get maximum_size(): number;
set maximum_size(val: number);
/**
* The maximum size allocated to the child.
*
* It is the width if the clamp is horizontal, or the height if it is vertical.
*/
get maximumSize(): number;
set maximumSize(val: number);
/**
* The size above which the child is clamped.
*
* Starting from this size, the clamp will tighten its grip on the child,
* slowly allocating less and less of the available size up to the maximum
* allocated size. Below that threshold and below the maximum size, the child
* will be allocated all the available size.
*
* If the threshold is greater than the maximum size to allocate to the child,
* the child will be allocated all the size up to the maximum.
* If the threshold is lower than the minimum size to allocate to the child,
* that size will be used as the tightening threshold.
*
* Effectively, tightening the grip on the child before it reaches its maximum
* size makes transitions to and from the maximum size smoother when resizing.
*/
get tightening_threshold(): number;
set tightening_threshold(val: number);
/**
* The size above which the child is clamped.
*
* Starting from this size, the clamp will tighten its grip on the child,
* slowly allocating less and less of the available size up to the maximum
* allocated size. Below that threshold and below the maximum size, the child
* will be allocated all the available size.
*
* If the threshold is greater than the maximum size to allocate to the child,
* the child will be allocated all the size up to the maximum.
* If the threshold is lower than the minimum size to allocate to the child,
* that size will be used as the tightening threshold.
*
* Effectively, tightening the grip on the child before it reaches its maximum
* size makes transitions to and from the maximum size smoother when resizing.
*/
get tighteningThreshold(): number;
set tighteningThreshold(val: number);
/**
* The length unit for maximum size and tightening threshold.
*
* Allows the sizes to vary depending on the text scale factor.
*/
get unit(): LengthUnit;
set unit(val: LengthUnit);
// Constructors
constructor(properties?: Partial<Clamp.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): Clamp;
// Methods
/**
* Gets the child widget of `self`.
* @returns the child widget of @self
*/
get_child(): Gtk.Widget | null;
/**
* Gets the maximum size allocated to the child.
* @returns the maximum size to allocate to the child
*/
get_maximum_size(): number;
/**
* Gets the size above which the child is clamped.
* @returns the size above which the child is clamped
*/
get_tightening_threshold(): number;
/**
* Gets the length unit for maximum size and tightening threshold.
* @returns the length unit
*/
get_unit(): LengthUnit;
/**
* Sets the child widget of `self`.
* @param child the child widget
*/
set_child(child?: Gtk.Widget | null): void;
/**
* Sets the maximum size allocated to the child.
*
* It is the width if the clamp is horizontal, or the height if it is vertical.
* @param maximum_size the maximum size
*/
set_maximum_size(maximum_size: number): void;
/**
* Sets the size above which the child is clamped.
*
* Starting from this size, the clamp will tighten its grip on the child, slowly
* allocating less and less of the available size up to the maximum allocated
* size. Below that threshold and below the maximum size, the child will be
* allocated all the available size.
*
* If the threshold is greater than the maximum size to allocate to the child,
* the child will be allocated all the size up to the maximum. If the threshold
* is lower than the minimum size to allocate to the child, that size will be
* used as the tightening threshold.
*
* Effectively, tightening the grip on the child before it reaches its maximum
* size makes transitions to and from the maximum size smoother when resizing.
* @param tightening_threshold the tightening threshold
*/
set_tightening_threshold(tightening_threshold: number): void;
/**
* Sets the length unit for maximum size and tightening threshold.
*
* Allows the sizes to vary depending on the text scale factor.
* @param unit the length unit
*/
set_unit(unit: LengthUnit | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* The orientation of the orientable.
*/
get orientation(): Gtk.Orientation;
set orientation(val: Gtk.Orientation);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: string): void;
/**
* Retrieves the orientation of the `orientable`.
* @returns the orientation of the @orientable
*/
get_orientation(): Gtk.Orientation;
/**
* Sets the orientation of the `orientable`.
* @param orientation the orientables new orientation
*/
set_orientation(orientation: Gtk.Orientation | null): 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 ClampLayout {
// Constructor properties interface
interface ConstructorProps extends Gtk.LayoutManager.ConstructorProps, Gtk.Orientable.ConstructorProps {
maximum_size: number;
maximumSize: number;
tightening_threshold: number;
tighteningThreshold: number;
unit: LengthUnit;
}
}
/**
* A layout manager constraining its children to a given size.
*
* <picture>
* <source srcset="clamp-wide-dark.png" media="(prefers-color-scheme: dark)">
* <img src="clamp-wide.png" alt="clamp-wide">
* </picture>
* <picture>
* <source srcset="clamp-narrow-dark.png" media="(prefers-color-scheme: dark)">
* <img src="clamp-narrow.png" alt="clamp-narrow">
* </picture>
*
* `AdwClampLayout` constraints the size of the widgets it contains to a given
* maximum size. It will constrain the width if it is horizontal, or the height
* if it is vertical. The expansion of the children from their minimum to their
* maximum size is eased out for a smooth transition.
*
* If a child requires more than the requested maximum size, it will be
* allocated the minimum size it can fit in instead.
*
* `AdwClampLayout` can scale with the text scale factor, use the
* [property`ClampLayout:`unit] property to enable that behavior.
*
* See also: [class`Clamp]`, [class`ClampScrollable]`.
*/
class ClampLayout extends Gtk.LayoutManager implements Gtk.Orientable {
static $gtype: GObject.GType<ClampLayout>;
// Properties
/**
* The maximum size to allocate to the children.
*
* It is the width if the layout is horizontal, or the height if it is
* vertical.
*/
get maximum_size(): number;
set maximum_size(val: number);
/**
* The maximum size to allocate to the children.
*
* It is the width if the layout is horizontal, or the height if it is
* vertical.
*/
get maximumSize(): number;
set maximumSize(val: number);
/**
* The size above which the children are clamped.
*
* Starting from this size, the layout will tighten its grip on the children,
* slowly allocating less and less of the available size up to the maximum
* allocated size. Below that threshold and below the maximum size, the
* children will be allocated all the available size.
*
* If the threshold is greater than the maximum size to allocate to the
* children, they will be allocated the whole size up to the maximum. If the
* threshold is lower than the minimum size to allocate to the children, that
* size will be used as the tightening threshold.
*
* Effectively, tightening the grip on a child before it reaches its maximum
* size makes transitions to and from the maximum size smoother when resizing.
*/
get tightening_threshold(): number;
set tightening_threshold(val: number);
/**
* The size above which the children are clamped.
*
* Starting from this size, the layout will tighten its grip on the children,
* slowly allocating less and less of the available size up to the maximum
* allocated size. Below that threshold and below the maximum size, the
* children will be allocated all the available size.
*
* If the threshold is greater than the maximum size to allocate to the
* children, they will be allocated the whole size up to the maximum. If the
* threshold is lower than the minimum size to allocate to the children, that
* size will be used as the tightening threshold.
*
* Effectively, tightening the grip on a child before it reaches its maximum
* size makes transitions to and from the maximum size smoother when resizing.
*/
get tighteningThreshold(): number;
set tighteningThreshold(val: number);
/**
* The length unit for maximum size and tightening threshold.
*
* Allows the sizes to vary depending on the text scale factor.
*/
get unit(): LengthUnit;
set unit(val: LengthUnit);
// Constructors
constructor(properties?: Partial<ClampLayout.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): ClampLayout;
// Methods
/**
* Gets the maximum size allocated to the children.
* @returns the maximum size to allocate to the children
*/
get_maximum_size(): number;
/**
* Gets the size above which the children are clamped.
* @returns the size above which the children are clamped
*/
get_tightening_threshold(): number;
/**
* Gets the length unit for maximum size and tightening threshold.
* @returns the length unit
*/
get_unit(): LengthUnit;
/**
* Sets the maximum size allocated to the children.
*
* It is the width if the layout is horizontal, or the height if it is vertical.
* @param maximum_size the maximum size
*/
set_maximum_size(maximum_size: number): void;
/**
* Sets the size above which the children are clamped.
*
* Starting from this size, the layout will tighten its grip on the children,
* slowly allocating less and less of the available size up to the maximum
* allocated size. Below that threshold and below the maximum size, the children
* will be allocated all the available size.
*
* If the threshold is greater than the maximum size to allocate to the
* children, they will be allocated the whole size up to the maximum. If the
* threshold is lower than the minimum size to allocate to the children, that
* size will be used as the tightening threshold.
*
* Effectively, tightening the grip on a child before it reaches its maximum
* size makes transitions to and from the maximum size smoother when resizing.
* @param tightening_threshold the tightening threshold
*/
set_tightening_threshold(tightening_threshold: number): void;
/**
* Sets the length unit for maximum size and tightening threshold.
*
* Allows the sizes to vary depending on the text scale factor.
* @param unit the length unit
*/
set_unit(unit: LengthUnit | null): void;
// Inherited properties
/**
* The orientation of the orientable.
*/
get orientation(): Gtk.Orientation;
set orientation(val: Gtk.Orientation);
// Inherited methods
/**
* Retrieves the orientation of the `orientable`.
* @returns the orientation of the @orientable
*/
get_orientation(): Gtk.Orientation;
/**
* Sets the orientation of the `orientable`.
* @param orientation the orientables new orientation
*/
set_orientation(orientation: Gtk.Orientation | null): 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 ClampScrollable {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Orientable.ConstructorProps,
Gtk.Scrollable.ConstructorProps {
child: Gtk.Widget;
maximum_size: number;
maximumSize: number;
tightening_threshold: number;
tighteningThreshold: number;
unit: LengthUnit;
}
}
/**
* A scrollable [class`Clamp]`.
*
* `AdwClampScrollable` is a variant of [class`Clamp]` that implements the
* [iface`Gtk`.Scrollable] interface.
*
* The primary use case for `AdwClampScrollable` is clamping
* [class`Gtk`.ListView].
*
* See also: [class`ClampLayout]`.
*/
class ClampScrollable
extends Gtk.Widget
implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Orientable, Gtk.Scrollable
{
static $gtype: GObject.GType<ClampScrollable>;
// Properties
/**
* The child widget of the `AdwClampScrollable`.
*/
get child(): Gtk.Widget;
set child(val: Gtk.Widget);
/**
* The maximum size allocated to the child.
*
* It is the width if the clamp is horizontal, or the height if it is vertical.
*/
get maximum_size(): number;
set maximum_size(val: number);
/**
* The maximum size allocated to the child.
*
* It is the width if the clamp is horizontal, or the height if it is vertical.
*/
get maximumSize(): number;
set maximumSize(val: number);
/**
* The size above which the child is clamped.
*
* Starting from this size, the clamp will tighten its grip on the child,
* slowly allocating less and less of the available size up to the maximum
* allocated size. Below that threshold and below the maximum width, the child
* will be allocated all the available size.
*
* If the threshold is greater than the maximum size to allocate to the child,
* the child will be allocated all the width up to the maximum.
* If the threshold is lower than the minimum size to allocate to the child,
* that size will be used as the tightening threshold.
*
* Effectively, tightening the grip on the child before it reaches its maximum
* size makes transitions to and from the maximum size smoother when resizing.
*/
get tightening_threshold(): number;
set tightening_threshold(val: number);
/**
* The size above which the child is clamped.
*
* Starting from this size, the clamp will tighten its grip on the child,
* slowly allocating less and less of the available size up to the maximum
* allocated size. Below that threshold and below the maximum width, the child
* will be allocated all the available size.
*
* If the threshold is greater than the maximum size to allocate to the child,
* the child will be allocated all the width up to the maximum.
* If the threshold is lower than the minimum size to allocate to the child,
* that size will be used as the tightening threshold.
*
* Effectively, tightening the grip on the child before it reaches its maximum
* size makes transitions to and from the maximum size smoother when resizing.
*/
get tighteningThreshold(): number;
set tighteningThreshold(val: number);
/**
* The length unit for maximum size and tightening threshold.
*
* Allows the sizes to vary depending on the text scale factor.
*/
get unit(): LengthUnit;
set unit(val: LengthUnit);
// Constructors
constructor(properties?: Partial<ClampScrollable.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): ClampScrollable;
// Methods
/**
* Gets the child widget of `self`.
* @returns the child widget of @self
*/
get_child(): Gtk.Widget | null;
/**
* Gets the maximum size allocated to the child.
* @returns the maximum size to allocate to the child
*/
get_maximum_size(): number;
/**
* Gets the size above which the child is clamped.
* @returns the size above which the child is clamped
*/
get_tightening_threshold(): number;
/**
* Gets the length unit for maximum size and tightening threshold.
* @returns the length unit
*/
get_unit(): LengthUnit;
/**
* Sets the child widget of `self`.
* @param child the child widget
*/
set_child(child?: Gtk.Widget | null): void;
/**
* Sets the maximum size allocated to the child.
*
* It is the width if the clamp is horizontal, or the height if it is vertical.
* @param maximum_size the maximum size
*/
set_maximum_size(maximum_size: number): void;
/**
* Sets the size above which the child is clamped.
*
* Starting from this size, the clamp will tighten its grip on the child, slowly
* allocating less and less of the available size up to the maximum allocated
* size. Below that threshold and below the maximum width, the child will be
* allocated all the available size.
*
* If the threshold is greater than the maximum size to allocate to the child,
* the child will be allocated all the width up to the maximum. If the threshold
* is lower than the minimum size to allocate to the child, that size will be
* used as the tightening threshold.
*
* Effectively, tightening the grip on the child before it reaches its maximum
* size makes transitions to and from the maximum size smoother when resizing.
* @param tightening_threshold the tightening threshold
*/
set_tightening_threshold(tightening_threshold: number): void;
/**
* Sets the length unit for maximum size and tightening threshold.
*
* Allows the sizes to vary depending on the text scale factor.
* @param unit the length unit
*/
set_unit(unit: LengthUnit | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* The orientation of the orientable.
*/
get orientation(): Gtk.Orientation;
set orientation(val: Gtk.Orientation);
/**
* Horizontal `GtkAdjustment` of the scrollable widget.
*
* This adjustment is shared between the scrollable widget and its parent.
*/
get hadjustment(): Gtk.Adjustment;
set hadjustment(val: Gtk.Adjustment);
/**
* Determines when horizontal scrolling should start.
*/
get hscroll_policy(): Gtk.ScrollablePolicy;
set hscroll_policy(val: Gtk.ScrollablePolicy);
/**
* Determines when horizontal scrolling should start.
*/
get hscrollPolicy(): Gtk.ScrollablePolicy;
set hscrollPolicy(val: Gtk.ScrollablePolicy);
/**
* Vertical `GtkAdjustment` of the scrollable widget.
*
* This adjustment is shared between the scrollable widget and its parent.
*/
get vadjustment(): Gtk.Adjustment;
set vadjustment(val: Gtk.Adjustment);
/**
* Determines when vertical scrolling should start.
*/
get vscroll_policy(): Gtk.ScrollablePolicy;
set vscroll_policy(val: Gtk.ScrollablePolicy);
/**
* Determines when vertical scrolling should start.
*/
get vscrollPolicy(): Gtk.ScrollablePolicy;
set vscrollPolicy(val: Gtk.ScrollablePolicy);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: string): void;
/**
* Retrieves the orientation of the `orientable`.
* @returns the orientation of the @orientable
*/
get_orientation(): Gtk.Orientation;
/**
* Sets the orientation of the `orientable`.
* @param orientation the orientables new orientation
*/
set_orientation(orientation: Gtk.Orientation | null): void;
/**
* Returns the size of a non-scrolling border around the
* outside of the scrollable.
*
* An example for this would be treeview headers. GTK can use
* this information to display overlaid graphics, like the
* overshoot indication, at the right position.
* @returns %TRUE if @border has been set
*/
get_border(): [boolean, Gtk.Border];
/**
* Retrieves the `GtkAdjustment` used for horizontal scrolling.
* @returns horizontal `GtkAdjustment`.
*/
get_hadjustment(): Gtk.Adjustment | null;
/**
* Gets the horizontal `GtkScrollablePolicy`.
* @returns The horizontal `GtkScrollablePolicy`.
*/
get_hscroll_policy(): Gtk.ScrollablePolicy;
/**
* Retrieves the `GtkAdjustment` used for vertical scrolling.
* @returns vertical `GtkAdjustment`.
*/
get_vadjustment(): Gtk.Adjustment | null;
/**
* Gets the vertical `GtkScrollablePolicy`.
* @returns The vertical `GtkScrollablePolicy`.
*/
get_vscroll_policy(): Gtk.ScrollablePolicy;
/**
* Sets the horizontal adjustment of the `GtkScrollable`.
* @param hadjustment a `GtkAdjustment`
*/
set_hadjustment(hadjustment?: Gtk.Adjustment | null): void;
/**
* Sets the `GtkScrollablePolicy`.
*
* The policy determines whether horizontal scrolling should start
* below the minimum width or below the natural width.
* @param policy the horizontal `GtkScrollablePolicy`
*/
set_hscroll_policy(policy: Gtk.ScrollablePolicy | null): void;
/**
* Sets the vertical adjustment of the `GtkScrollable`.
* @param vadjustment a `GtkAdjustment`
*/
set_vadjustment(vadjustment?: Gtk.Adjustment | null): void;
/**
* Sets the `GtkScrollablePolicy`.
*
* The policy determines whether vertical scrolling should start
* below the minimum height or below the natural height.
* @param policy the vertical `GtkScrollablePolicy`
*/
set_vscroll_policy(policy: Gtk.ScrollablePolicy | null): void;
/**
* Returns the size of a non-scrolling border around the
* outside of the scrollable.
*
* An example for this would be treeview headers. GTK can use
* this information to display overlaid graphics, like the
* overshoot indication, at the right position.
*/
vfunc_get_border(): [boolean, Gtk.Border];
/**
* 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 ComboRow {
// Constructor properties interface
interface ConstructorProps
extends ActionRow.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Actionable.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
enable_search: boolean;
enableSearch: boolean;
expression: Gtk.Expression;
factory: Gtk.ListItemFactory;
header_factory: Gtk.ListItemFactory;
headerFactory: Gtk.ListItemFactory;
list_factory: Gtk.ListItemFactory;
listFactory: Gtk.ListItemFactory;
model: Gio.ListModel;
search_match_mode: Gtk.StringFilterMatchMode;
searchMatchMode: Gtk.StringFilterMatchMode;
selected: number;
selected_item: GObject.Object;
selectedItem: GObject.Object;
use_subtitle: boolean;
useSubtitle: boolean;
}
}
/**
* A [class`Gtk`.ListBoxRow] used to choose from a list of items.
*
* <picture>
* <source srcset="combo-row-dark.png" media="(prefers-color-scheme: dark)">
* <img src="combo-row.png" alt="combo-row">
* </picture>
*
* The `AdwComboRow` widget allows the user to choose from a list of valid
* choices. The row displays the selected choice. When activated, the row
* displays a popover which allows the user to make a new choice.
*
* Example of an `AdwComboRow` UI definition:
* ```xml
* <object class="AdwComboRow">
* <property name="title" translatable="yes">Combo Row</property>
* <property name="model">
* <object class="GtkStringList">
* <items>
* <item translatable="yes">Foo</item>
* <item translatable="yes">Bar</item>
* <item translatable="yes">Baz</item>
* </items>
* </object>
* </property>
* </object>
* ```
*
* The [property`ComboRow:`selected] and [property`ComboRow:`selected-item]
* properties can be used to keep track of the selected item and react to their
* changes.
*
* `AdwComboRow` mirrors [class`Gtk`.DropDown], see that widget for details.
*
* `AdwComboRow` is [property`Gtk`.ListBoxRow:activatable] if a model is set.
*
* ## CSS nodes
*
* `AdwComboRow` has a main CSS node with name `row` and the `.combo` style
* class.
*
* Its popover has the node named `popover` with the `.menu` style class, it
* contains a [class`Gtk`.ScrolledWindow], which in turn contains a
* [class`Gtk`.ListView], both are accessible via their regular nodes.
*
* ## Accessibility
*
* `AdwComboRow` uses the `GTK_ACCESSIBLE_ROLE_COMBO_BOX` role.
*/
class ComboRow
extends ActionRow
implements Gtk.Accessible, Gtk.Actionable, Gtk.Buildable, Gtk.ConstraintTarget
{
static $gtype: GObject.GType<ComboRow>;
// Properties
/**
* Whether to show a search entry in the popup.
*
* If set to `TRUE`, a search entry will be shown in the popup that
* allows to search for items in the list.
*
* Search requires [property`ComboRow:`expression] to be set.
*/
get enable_search(): boolean;
set enable_search(val: boolean);
/**
* Whether to show a search entry in the popup.
*
* If set to `TRUE`, a search entry will be shown in the popup that
* allows to search for items in the list.
*
* Search requires [property`ComboRow:`expression] to be set.
*/
get enableSearch(): boolean;
set enableSearch(val: boolean);
/**
* An expression used to obtain strings from items.
*
* The expression must have a value type of `G_TYPE_STRING`.
*
* It's used to bind strings to labels produced by the default factory if
* [property`ComboRow:`factory] is not set, or when
* [property`ComboRow:`use-subtitle] is set to `TRUE`.
*/
get expression(): Gtk.Expression;
set expression(val: Gtk.Expression);
/**
* Factory for populating list items.
*
* This factory is always used for the item in the row. It is also used for
* items in the popup unless [property`ComboRow:`list-factory] is set.
*/
get factory(): Gtk.ListItemFactory;
set factory(val: Gtk.ListItemFactory);
/**
* The factory for creating header widgets for the popup.
*/
get header_factory(): Gtk.ListItemFactory;
set header_factory(val: Gtk.ListItemFactory);
/**
* The factory for creating header widgets for the popup.
*/
get headerFactory(): Gtk.ListItemFactory;
set headerFactory(val: Gtk.ListItemFactory);
/**
* The factory for populating list items in the popup.
*
* If this is not set, [property`ComboRow:`factory] is used.
*/
get list_factory(): Gtk.ListItemFactory;
set list_factory(val: Gtk.ListItemFactory);
/**
* The factory for populating list items in the popup.
*
* If this is not set, [property`ComboRow:`factory] is used.
*/
get listFactory(): Gtk.ListItemFactory;
set listFactory(val: Gtk.ListItemFactory);
/**
* The model that provides the displayed items.
*/
get model(): Gio.ListModel;
set model(val: Gio.ListModel);
/**
* The match mode for the search filter.
*/
get search_match_mode(): Gtk.StringFilterMatchMode;
set search_match_mode(val: Gtk.StringFilterMatchMode);
/**
* The match mode for the search filter.
*/
get searchMatchMode(): Gtk.StringFilterMatchMode;
set searchMatchMode(val: Gtk.StringFilterMatchMode);
/**
* The position of the selected item.
*
* If no item is selected, the property has the value
* [const`Gtk`.INVALID_LIST_POSITION]
*/
get selected(): number;
set selected(val: number);
/**
* The selected item.
*/
get selected_item(): GObject.Object;
/**
* The selected item.
*/
get selectedItem(): GObject.Object;
/**
* Whether to use the current value as the subtitle.
*
* If you use a custom list item factory, you will need to give the row a
* name conversion expression with [property`ComboRow:`expression].
*
* If set to `TRUE`, you should not access [property`ActionRow:`subtitle].
*
* The subtitle is interpreted as Pango markup if
* [property`PreferencesRow:`use-markup] is set to `TRUE`.
*/
get use_subtitle(): boolean;
set use_subtitle(val: boolean);
/**
* Whether to use the current value as the subtitle.
*
* If you use a custom list item factory, you will need to give the row a
* name conversion expression with [property`ComboRow:`expression].
*
* If set to `TRUE`, you should not access [property`ActionRow:`subtitle].
*
* The subtitle is interpreted as Pango markup if
* [property`PreferencesRow:`use-markup] is set to `TRUE`.
*/
get useSubtitle(): boolean;
set useSubtitle(val: boolean);
// Constructors
constructor(properties?: Partial<ComboRow.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): ComboRow;
// Methods
/**
* Gets whether search is enabled.
*
* If set to `TRUE`, a search entry will be shown in the popup that
* allows to search for items in the list.
*
* Search requires [property`ComboRow:`expression] to be set.
* @returns whether the popup includes a search entry
*/
get_enable_search(): boolean;
/**
* Gets the expression used to obtain strings from items.
* @returns the expression used to obtain strings from items
*/
get_expression(): Gtk.Expression | null;
/**
* Gets the factory for populating list items.
* @returns the factory in use
*/
get_factory(): Gtk.ListItemFactory | null;
/**
* Gets the factory that's currently used to create header widgets for the popup.
* @returns The factory in use
*/
get_header_factory(): Gtk.ListItemFactory | null;
/**
* Gets the factory for populating list items in the popup.
* @returns the factory in use
*/
get_list_factory(): Gtk.ListItemFactory | null;
/**
* Gets the model that provides the displayed items.
* @returns The model in use
*/
get_model(): Gio.ListModel | null;
/**
* Returns the match mode that the search filter is using.
* @returns the match mode of the search filter
*/
get_search_match_mode(): Gtk.StringFilterMatchMode;
/**
* Gets the position of the selected item.
* @returns the position of the selected item, or [const@Gtk.INVALID_LIST_POSITION] if no item is selected
*/
get_selected(): number;
/**
* Gets the selected item.
* @returns the selected item
*/
get_selected_item<T = GObject.Object>(): T;
/**
* Gets whether to use the current value as the subtitle.
* @returns whether to use the current value as the subtitle
*/
get_use_subtitle(): boolean;
/**
* Sets whether to enable search.
*
* If set to `TRUE`, a search entry will be shown in the popup that
* allows to search for items in the list.
*
* Search requires [property`ComboRow:`expression] to be set.
* @param enable_search whether to enable search
*/
set_enable_search(enable_search: boolean): void;
/**
* Sets the expression used to obtain strings from items.
*
* The expression must have a value type of `G_TYPE_STRING`.
*
* It's used to bind strings to labels produced by the default factory if
* [property`ComboRow:`factory] is not set, or when
* [property`ComboRow:`use-subtitle] is set to `TRUE`.
* @param expression an expression
*/
set_expression(expression?: Gtk.Expression | null): void;
/**
* Sets the factory for populating list items.
*
* This factory is always used for the item in the row. It is also used for
* items in the popup unless [property`ComboRow:`list-factory] is set.
* @param factory the factory to use
*/
set_factory(factory?: Gtk.ListItemFactory | null): void;
/**
* Sets the factory to use for creating header widgets for the popup.
* @param factory the factory to use
*/
set_header_factory(factory?: Gtk.ListItemFactory | null): void;
/**
* Sets the factory for populating list items in the popup.
*
* If this is not set, [property`ComboRow:`factory] is used.
* @param factory the factory to use
*/
set_list_factory(factory?: Gtk.ListItemFactory | null): void;
/**
* Sets the model that provides the displayed items.
* @param model the model to use
*/
set_model(model?: Gio.ListModel | null): void;
/**
* Sets the match mode for the search filter.
* @param search_match_mode the new match mode
*/
set_search_match_mode(search_match_mode: Gtk.StringFilterMatchMode | null): void;
/**
* Selects the item at the given position.
* @param position the position of the item to select, or [const@Gtk.INVALID_LIST_POSITION]
*/
set_selected(position: number): void;
/**
* Sets whether to use the current value as the subtitle.
*
* If you use a custom list item factory, you will need to give the row a
* name conversion expression with [property`ComboRow:`expression].
*
* If set to `TRUE`, you should not access [property`ActionRow:`subtitle].
*
* The subtitle is interpreted as Pango markup if
* [property`PreferencesRow:`use-markup] is set to `TRUE`.
* @param use_subtitle whether to use the current value as the subtitle
*/
set_use_subtitle(use_subtitle: boolean): void;
// Inherited properties
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// 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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
// Conflicted with Adw.ActionRow.activate
activate(...args: never[]): any;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace Dialog {
// Signal callback interfaces
interface CloseAttempt {
(): void;
}
interface Closed {
(): void;
}
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.ShortcutManager.ConstructorProps {
can_close: boolean;
canClose: boolean;
child: Gtk.Widget;
content_height: number;
contentHeight: number;
content_width: number;
contentWidth: number;
current_breakpoint: Breakpoint;
currentBreakpoint: Breakpoint;
default_widget: Gtk.Widget;
defaultWidget: Gtk.Widget;
focus_widget: Gtk.Widget;
focusWidget: Gtk.Widget;
follows_content_size: boolean;
followsContentSize: boolean;
presentation_mode: DialogPresentationMode;
presentationMode: DialogPresentationMode;
title: string;
}
}
/**
* An adaptive dialog container.
*
* <picture>
* <source srcset="dialog-floating-dark.png" media="(prefers-color-scheme: dark)">
* <img src="dialog-floating.png" alt="dialog-floating">
* </picture>
* <picture>
* <source srcset="dialog-bottom-dark.png" media="(prefers-color-scheme: dark)">
* <img src="dialog-bottom.png" alt="dialog-bottom">
* </picture>
*
* `AdwDialog` is similar to a window, but is shown within another window. It
* can be used with [class`Window]` and [class`ApplicationWindow]`, use
* [method`Dialog`.present] to show it.
*
* `AdwDialog` is not resizable. Use the [property`Dialog:`content-width] and
* [property`Dialog:`content-height] properties to set its size, or set
* [property`Dialog:`follows-content-size] to `TRUE` to make the dialog track the
* content's size as it changes. `AdwDialog` can never be larger than its parent
* window.
*
* `AdwDialog` can be presented as a centered floating window or a bottom sheet.
* By default it's automatic depending on the available size.
* [property`Dialog:`presentation-mode] can be used to change that.
*
* `AdwDialog` can be closed via [method`Dialog`.close].
*
* When presented as a bottom sheet, `AdwDialog` can also be closed via swiping
* it down.
*
* The [property`Dialog:`can-close] can be used to prevent closing. In that case,
* [signal`Dialog:`:close-attempt] gets emitted instead.
*
* Use [method`Dialog`.force_close] to close the dialog even when `can-close` is set to
* `FALSE`.
*
* `AdwDialog` is transient and doesn't integrate with the window below it, for
* example it's not possible to collapse it into a bottom bar. See
* [class`BottomSheet]` for persistent and more tightly integrated bottom sheets.
*
* ## Header Bar Integration
*
* When placed inside an `AdwDialog`, [class`HeaderBar]` will display the dialog
* title instead of window title. It will also adjust the decoration layout to
* ensure it always has a close button and nothing else. Set
* [property`HeaderBar:`show-start-title-buttons] and
* [property`HeaderBar:`show-end-title-buttons] to `FALSE` to remove it if it's
* unwanted.
*
* ## Breakpoints
*
* `AdwDialog` can be used with [class`Breakpoint]` the same way as
* [class`BreakpointBin]`. Refer to that widget's documentation for details.
*
* Like `AdwBreakpointBin`, if breakpoints are used, `AdwDialog` doesn't have a
* minimum size, and [property`Gtk`.Widget:width-request] and
* [property`Gtk`.Widget:height-request] properties must be set manually.
*/
class Dialog
extends Gtk.Widget
implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.ShortcutManager
{
static $gtype: GObject.GType<Dialog>;
// Properties
/**
* Whether the dialog can be closed.
*
* If set to `FALSE`, the close button, shortcuts and
* [method`Dialog`.close] will result in [signal`Dialog:`:close-attempt] being
* emitted instead, and bottom sheet close swipe will be disabled.
* [method`Dialog`.force_close] still works.
*/
get can_close(): boolean;
set can_close(val: boolean);
/**
* Whether the dialog can be closed.
*
* If set to `FALSE`, the close button, shortcuts and
* [method`Dialog`.close] will result in [signal`Dialog:`:close-attempt] being
* emitted instead, and bottom sheet close swipe will be disabled.
* [method`Dialog`.force_close] still works.
*/
get canClose(): boolean;
set canClose(val: boolean);
/**
* The child widget of the `AdwDialog`.
*/
get child(): Gtk.Widget;
set child(val: Gtk.Widget);
/**
* The height of the dialog's contents.
*
* Set it to -1 to reset it to the content's natural height.
*
* See also: [property`Gtk`.Window:default-height]
*/
get content_height(): number;
set content_height(val: number);
/**
* The height of the dialog's contents.
*
* Set it to -1 to reset it to the content's natural height.
*
* See also: [property`Gtk`.Window:default-height]
*/
get contentHeight(): number;
set contentHeight(val: number);
/**
* The width of the dialog's contents.
*
* Set it to -1 to reset it to the content's natural width.
*
* See also: [property`Gtk`.Window:default-width]
*/
get content_width(): number;
set content_width(val: number);
/**
* The width of the dialog's contents.
*
* Set it to -1 to reset it to the content's natural width.
*
* See also: [property`Gtk`.Window:default-width]
*/
get contentWidth(): number;
set contentWidth(val: number);
/**
* The current breakpoint.
*/
get current_breakpoint(): Breakpoint;
/**
* The current breakpoint.
*/
get currentBreakpoint(): Breakpoint;
/**
* The default widget.
*
* It's activated when the user presses Enter.
*/
get default_widget(): Gtk.Widget;
set default_widget(val: Gtk.Widget);
/**
* The default widget.
*
* It's activated when the user presses Enter.
*/
get defaultWidget(): Gtk.Widget;
set defaultWidget(val: Gtk.Widget);
/**
* The focus widget.
*/
get focus_widget(): Gtk.Widget;
set focus_widget(val: Gtk.Widget);
/**
* The focus widget.
*/
get focusWidget(): Gtk.Widget;
set focusWidget(val: Gtk.Widget);
/**
* Whether to size content automatically.
*
* If set to `TRUE`, always use the content's natural size instead of
* [property`Dialog:`content-width] and [property`Dialog:`content-height]. If
* the content resizes, the dialog will immediately resize as well.
*
* See also: [property`Gtk`.Window:resizable]
*/
get follows_content_size(): boolean;
set follows_content_size(val: boolean);
/**
* Whether to size content automatically.
*
* If set to `TRUE`, always use the content's natural size instead of
* [property`Dialog:`content-width] and [property`Dialog:`content-height]. If
* the content resizes, the dialog will immediately resize as well.
*
* See also: [property`Gtk`.Window:resizable]
*/
get followsContentSize(): boolean;
set followsContentSize(val: boolean);
/**
* The dialog's presentation mode.
*
* When set to `ADW_DIALOG_AUTO`, the dialog appears as a bottom sheet when
* the following condition is met: `max-width: 450px or max-height: 360px`,
* and as a floating window otherwise.
*
* Set it to `ADW_DIALOG_FLOATING` or `ADW_DIALOG_BOTTOM_SHEET` to always
* present it a floating window or a bottom sheet respectively, regardless of
* available size.
*
* Presentation mode does nothing for dialogs presented as a window.
*/
get presentation_mode(): DialogPresentationMode;
set presentation_mode(val: DialogPresentationMode);
/**
* The dialog's presentation mode.
*
* When set to `ADW_DIALOG_AUTO`, the dialog appears as a bottom sheet when
* the following condition is met: `max-width: 450px or max-height: 360px`,
* and as a floating window otherwise.
*
* Set it to `ADW_DIALOG_FLOATING` or `ADW_DIALOG_BOTTOM_SHEET` to always
* present it a floating window or a bottom sheet respectively, regardless of
* available size.
*
* Presentation mode does nothing for dialogs presented as a window.
*/
get presentationMode(): DialogPresentationMode;
set presentationMode(val: DialogPresentationMode);
/**
* The title of the dialog.
*/
get title(): string;
set title(val: string);
// Constructors
constructor(properties?: Partial<Dialog.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): Dialog;
// 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: 'close-attempt', callback: (_source: this) => void): number;
connect_after(signal: 'close-attempt', callback: (_source: this) => void): number;
emit(signal: 'close-attempt'): void;
connect(signal: 'closed', callback: (_source: this) => void): number;
connect_after(signal: 'closed', callback: (_source: this) => void): number;
emit(signal: 'closed'): void;
// Virtual methods
vfunc_close_attempt(): void;
vfunc_closed(): void;
// Methods
/**
* Adds `breakpoint` to `self`.
* @param breakpoint the breakpoint to add
*/
add_breakpoint(breakpoint: Breakpoint): void;
/**
* Attempts to close `self`.
*
* If the [property`Dialog:`can-close] property is set to `FALSE`, the
* [signal`Dialog:`:close-attempt] signal is emitted.
*
* See also: [method`Dialog`.force_close].
* @returns whether @self was successfully closed
*/
close(): boolean;
/**
* Closes `self`.
*
* Unlike [method`Dialog`.close], it succeeds even if [property`Dialog:`can-close]
* is set to `FALSE`.
*/
force_close(): void;
/**
* Gets whether `self` can be closed.
* @returns whether the dialog can be closed
*/
get_can_close(): boolean;
/**
* Gets the child widget of `self`.
* @returns the child widget of @self
*/
get_child(): Gtk.Widget | null;
/**
* Gets the height of the dialog's contents.
* @returns the content height
*/
get_content_height(): number;
/**
* Gets the width of the dialog's contents.
* @returns the content width
*/
get_content_width(): number;
/**
* Gets the current breakpoint.
* @returns the current breakpoint
*/
get_current_breakpoint(): Breakpoint | null;
/**
* Gets the default widget for `self`.
* @returns the default widget
*/
get_default_widget(): Gtk.Widget | null;
/**
* Gets the focus widget for `self`.
* @returns the focus widget
*/
get_focus(): Gtk.Widget | null;
/**
* Gets whether to size content of `self` automatically.
* @returns whether to size content automatically
*/
get_follows_content_size(): boolean;
/**
* Gets presentation mode for `self`.
* @returns the presentation mode
*/
get_presentation_mode(): DialogPresentationMode;
/**
* Gets the title of `self`.
* @returns the title
*/
get_title(): string;
/**
* Presents `self` within `parent'`s window.
*
* If `self` is already shown, raises it to the top instead.
*
* If the window is an [class`Window]` or [class`ApplicationWindow]`, the dialog
* will be shown within it. Otherwise, it will be a separate window.
* @param parent a widget within the toplevel
*/
present(parent?: Gtk.Widget | null): void;
/**
* Sets whether `self` can be closed.
*
* If set to `FALSE`, the close button, shortcuts and
* [method`Dialog`.close] will result in [signal`Dialog:`:close-attempt] being
* emitted instead, and bottom sheet close swipe will be disabled.
* [method`Dialog`.force_close] still works.
* @param can_close whether to allow closing
*/
set_can_close(can_close: boolean): void;
/**
* Sets the child widget of `self`.
* @param child the child widget
*/
set_child(child?: Gtk.Widget | null): void;
/**
* Sets the height of the dialog's contents.
*
* Set it to -1 to reset it to the content's natural height.
*
* See also: [property`Gtk`.Window:default-height]
* @param content_height the content height
*/
set_content_height(content_height: number): void;
/**
* Sets the width of the dialog's contents.
*
* Set it to -1 to reset it to the content's natural width.
*
* See also: [property`Gtk`.Window:default-width]
* @param content_width the content width
*/
set_content_width(content_width: number): void;
/**
* Sets the default widget for `self`.
*
* It's activated when the user presses Enter.
* @param default_widget the default widget
*/
set_default_widget(default_widget?: Gtk.Widget | null): void;
/**
* Sets the focus widget for `self`.
*
* If `focus` is not the current focus widget, and is focusable, sets it as the
* focus widget for the dialog.
*
* If focus is `NULL`, unsets the focus widget for this dialog. To set the focus
* to a particular widget in the dialog, it is usually more convenient to use
* [method`Gtk`.Widget.grab_focus] instead of this function.
* @param focus the focus widget
*/
set_focus(focus?: Gtk.Widget | null): void;
/**
* Sets whether to size content of `self` automatically.
*
* If set to `TRUE`, always use the content's natural size instead of
* [property`Dialog:`content-width] and [property`Dialog:`content-height]. If
* the content resizes, the dialog will immediately resize as well.
*
* See also: [property`Gtk`.Window:resizable]
* @param follows_content_size whether to size content automatically
*/
set_follows_content_size(follows_content_size: boolean): void;
/**
* Sets presentation mode for `self`.
*
* When set to `ADW_DIALOG_AUTO`, the dialog appears as a bottom sheet when the
* following condition is met: `max-width: 450px or max-height: 360px`, and as a
* floating window otherwise.
*
* Set it to `ADW_DIALOG_FLOATING` or `ADW_DIALOG_BOTTOM_SHEET` to always
* present it a floating window or a bottom sheet respectively, regardless of
* available size.
*
* Presentation mode does nothing for dialogs presented as a window.
* @param presentation_mode the new presentation mode
*/
set_presentation_mode(presentation_mode: DialogPresentationMode | null): void;
/**
* Sets the title of `self`.
* @param title the new title
*/
set_title(title: string): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: string): void;
/**
* Add a `GtkShortcutController` to be managed.
* @param controller
*/
vfunc_add_controller(controller: Gtk.ShortcutController): void;
/**
* Remove a `GtkShortcutController` that had previously
* been added
* @param controller
*/
vfunc_remove_controller(controller: Gtk.ShortcutController): 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 EntryRow {
// Signal callback interfaces
interface Apply {
(): void;
}
interface EntryActivated {
(): void;
}
// Constructor properties interface
interface ConstructorProps
extends PreferencesRow.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Actionable.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Editable.ConstructorProps {
activates_default: boolean;
activatesDefault: boolean;
attributes: Pango.AttrList;
enable_emoji_completion: boolean;
enableEmojiCompletion: boolean;
input_hints: Gtk.InputHints;
inputHints: Gtk.InputHints;
input_purpose: Gtk.InputPurpose;
inputPurpose: Gtk.InputPurpose;
max_length: number;
maxLength: number;
show_apply_button: boolean;
showApplyButton: boolean;
text_length: number;
textLength: number;
}
}
/**
* A [class`Gtk`.ListBoxRow] with an embedded text entry.
*
* <picture>
* <source srcset="entry-row-dark.png" media="(prefers-color-scheme: dark)">
* <img src="entry-row.png" alt="entry-row">
* </picture>
*
* `AdwEntryRow` has a title that doubles as placeholder text. It shows an icon
* indicating that it's editable and can receive additional widgets before or
* after the editable part.
*
* If [property`EntryRow:`show-apply-button] is set to `TRUE`, `AdwEntryRow` can
* show an apply button when editing its contents. This can be useful if
* changing its contents can result in an expensive operation, such as network
* activity.
*
* `AdwEntryRow` provides only minimal API and should be used with the
* [iface`Gtk`.Editable] API.
*
* See also [class`PasswordEntryRow]`.
*
* ## AdwEntryRow as GtkBuildable
*
* The `AdwEntryRow` implementation of the [iface`Gtk`.Buildable] interface
* supports adding a child at its end by specifying “suffix” or omitting the
* “type” attribute of a <child> element.
*
* It also supports adding a child as a prefix widget by specifying “prefix” as
* the “type” attribute of a <child> element.
*
* ## CSS nodes
*
* `AdwEntryRow` has a single CSS node with name `row` and the `.entry` style
* class.
*/
class EntryRow
extends PreferencesRow
implements Gtk.Accessible, Gtk.Actionable, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Editable
{
static $gtype: GObject.GType<EntryRow>;
// Properties
/**
* Whether activating the embedded entry can activate the default widget.
*/
get activates_default(): boolean;
set activates_default(val: boolean);
/**
* Whether activating the embedded entry can activate the default widget.
*/
get activatesDefault(): boolean;
set activatesDefault(val: boolean);
/**
* A list of Pango attributes to apply to the text of the embedded entry.
*
* The [struct`Pango`.Attribute]'s `start_index` and `end_index` must refer to
* the [class`Gtk`.EntryBuffer] text, i.e. without the preedit string.
*/
get attributes(): Pango.AttrList;
set attributes(val: Pango.AttrList);
/**
* Whether to suggest emoji replacements on the entry row.
*
* Emoji replacement is done with :-delimited names, like `:heart:`.
*/
get enable_emoji_completion(): boolean;
set enable_emoji_completion(val: boolean);
/**
* Whether to suggest emoji replacements on the entry row.
*
* Emoji replacement is done with :-delimited names, like `:heart:`.
*/
get enableEmojiCompletion(): boolean;
set enableEmojiCompletion(val: boolean);
/**
* Additional input hints for the entry row.
*
* Input hints allow input methods to fine-tune their behavior.
*
* See also: [property`Adw`.EntryRow:input-purpose]
*/
get input_hints(): Gtk.InputHints;
set input_hints(val: Gtk.InputHints);
/**
* Additional input hints for the entry row.
*
* Input hints allow input methods to fine-tune their behavior.
*
* See also: [property`Adw`.EntryRow:input-purpose]
*/
get inputHints(): Gtk.InputHints;
set inputHints(val: Gtk.InputHints);
/**
* The input purpose of the entry row.
*
* The input purpose can be used by input methods to adjust their behavior.
*/
get input_purpose(): Gtk.InputPurpose;
set input_purpose(val: Gtk.InputPurpose);
/**
* The input purpose of the entry row.
*
* The input purpose can be used by input methods to adjust their behavior.
*/
get inputPurpose(): Gtk.InputPurpose;
set inputPurpose(val: Gtk.InputPurpose);
/**
* Maximum number of characters for the entry.
*/
get max_length(): number;
set max_length(val: number);
/**
* Maximum number of characters for the entry.
*/
get maxLength(): number;
set maxLength(val: number);
/**
* Whether to show the apply button.
*
* When set to `TRUE`, typing text in the entry will reveal an apply button.
* Clicking it or pressing the <kbd>Enter</kbd> key will hide the button and
* emit the [signal`EntryRow:`:apply] signal.
*
* This is useful if changing the entry contents can trigger an expensive
* operation, e.g. network activity, to avoid triggering it after typing every
* character.
*/
get show_apply_button(): boolean;
set show_apply_button(val: boolean);
/**
* Whether to show the apply button.
*
* When set to `TRUE`, typing text in the entry will reveal an apply button.
* Clicking it or pressing the <kbd>Enter</kbd> key will hide the button and
* emit the [signal`EntryRow:`:apply] signal.
*
* This is useful if changing the entry contents can trigger an expensive
* operation, e.g. network activity, to avoid triggering it after typing every
* character.
*/
get showApplyButton(): boolean;
set showApplyButton(val: boolean);
/**
* The length of the text in the entry row.
*/
get text_length(): number;
/**
* The length of the text in the entry row.
*/
get textLength(): number;
// Constructors
constructor(properties?: Partial<EntryRow.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): EntryRow;
// 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: 'apply', callback: (_source: this) => void): number;
connect_after(signal: 'apply', callback: (_source: this) => void): number;
emit(signal: 'apply'): void;
connect(signal: 'entry-activated', callback: (_source: this) => void): number;
connect_after(signal: 'entry-activated', callback: (_source: this) => void): number;
emit(signal: 'entry-activated'): void;
// Methods
/**
* Adds a prefix widget to `self`.
* @param widget a widget
*/
add_prefix(widget: Gtk.Widget): void;
/**
* Adds a suffix widget to `self`.
* @param widget a widget
*/
add_suffix(widget: Gtk.Widget): void;
/**
* Gets whether activating the embedded entry can activate the default widget.
* @returns whether to activate the default widget
*/
get_activates_default(): boolean;
/**
* Gets Pango attributes applied to the text of the embedded entry.
* @returns the list of attributes
*/
get_attributes(): Pango.AttrList | null;
/**
* Gets whether to suggest emoji replacements on `self`.
* @returns whether or not emoji completion is enabled
*/
get_enable_emoji_completion(): boolean;
/**
* Gets the additional input hints of `self`.
* @returns The input hints
*/
get_input_hints(): Gtk.InputHints;
/**
* Gets the input purpose of `self`.
* @returns the input purpose
*/
get_input_purpose(): Gtk.InputPurpose;
/**
* Retrieves the maximum length of the entry.
* @returns The maximum length of the entry.
*/
get_max_length(): number;
/**
* Gets whether `self` can show the apply button.
* @returns whether to show the apply button
*/
get_show_apply_button(): boolean;
/**
* Retrieves the current length of the text in `self`.
* @returns The current number of characters in @self, or 0 if there are none.
*/
get_text_length(): number;
/**
* Causes `self` to have keyboard focus without selecting the text.
*
* See [method`Gtk`.Text.grab_focus_without_selecting] for more information.
* @returns whether the focus is now inside @self
*/
grab_focus_without_selecting(): boolean;
/**
* Removes a child from `self`.
* @param widget the child to be removed
*/
remove(widget: Gtk.Widget): void;
/**
* Sets whether activating the embedded entry can activate the default widget.
* @param activates whether to activate the default widget
*/
set_activates_default(activates: boolean): void;
/**
* Sets Pango attributes to apply to the text of the embedded entry.
*
* The [struct`Pango`.Attribute]'s `start_index` and `end_index` must refer to
* the [class`Gtk`.EntryBuffer] text, i.e. without the preedit string.
* @param attributes a list of attributes
*/
set_attributes(attributes?: Pango.AttrList | null): void;
/**
* Sets whether to suggest emoji replacements on `self`.
*
* Emoji replacement is done with :-delimited names, like `:heart:`.
* @param enable_emoji_completion Whether emoji completion should be enabled or not
*/
set_enable_emoji_completion(enable_emoji_completion: boolean): void;
/**
* Set additional input hints for `self`.
*
* Input hints allow input methods to fine-tune their behavior.
*
* See also: [property`AdwEntryRow:`input-purpose]
* @param hints the hints
*/
set_input_hints(hints: Gtk.InputHints | null): void;
/**
* Sets the input purpose of `self`.
*
* The input purpose can be used by input methods to adjust their behavior.
* @param purpose the purpose
*/
set_input_purpose(purpose: Gtk.InputPurpose | null): void;
/**
* Sets the maximum length of the entry.
* @param max_length maximum length of the entry
*/
set_max_length(max_length: number): void;
/**
* Sets whether `self` can show the apply button.
*
* When set to `TRUE`, typing text in the entry will reveal an apply button.
* Clicking it or pressing the <kbd>Enter</kbd> key will hide the button and
* emit the [signal`EntryRow:`:apply] signal.
*
* This is useful if changing the entry contents can trigger an expensive
* operation, e.g. network activity, to avoid triggering it after typing every
* character.
* @param show_apply_button whether to show the apply button
*/
set_show_apply_button(show_apply_button: boolean): void;
// Inherited properties
/**
* The current position of the insertion cursor in chars.
*/
get cursor_position(): number;
/**
* The current position of the insertion cursor in chars.
*/
get cursorPosition(): number;
/**
* Whether the entry contents can be edited.
*/
get editable(): boolean;
set editable(val: boolean);
/**
* If undo/redo should be enabled for the editable.
*/
get enable_undo(): boolean;
set enable_undo(val: boolean);
/**
* If undo/redo should be enabled for the editable.
*/
get enableUndo(): boolean;
set enableUndo(val: boolean);
/**
* The desired maximum width of the entry, in characters.
*/
get max_width_chars(): number;
set max_width_chars(val: number);
/**
* The desired maximum width of the entry, in characters.
*/
get maxWidthChars(): number;
set maxWidthChars(val: number);
/**
* The position of the opposite end of the selection from the cursor in chars.
*/
get selection_bound(): number;
/**
* The position of the opposite end of the selection from the cursor in chars.
*/
get selectionBound(): number;
/**
* The contents of the entry.
*/
get text(): string;
set text(val: string);
/**
* Number of characters to leave space for in the entry.
*/
get width_chars(): number;
set width_chars(val: number);
/**
* Number of characters to leave space for in the entry.
*/
get widthChars(): number;
set widthChars(val: number);
/**
* The horizontal alignment, from 0 (left) to 1 (right).
*
* Reversed for RTL layouts.
*/
get xalign(): number;
set xalign(val: number);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// Inherited methods
/**
* Retrieves the accessible platform state from the editable delegate.
*
* This is an helper function to retrieve the accessible state for
* `GtkEditable` interface implementations using a delegate pattern.
*
* You should call this function in your editable widget implementation
* of the [vfunc`Gtk`.Accessible.get_platform_state] virtual function, for
* instance:
*
* ```c
* static void
* accessible_interface_init (GtkAccessibleInterface *iface)
* {
* iface->get_platform_state = your_editable_get_accessible_platform_state;
* }
*
* static gboolean
* your_editable_get_accessible_platform_state (GtkAccessible *accessible,
* GtkAccessiblePlatformState state)
* {
* return gtk_editable_delegate_get_accessible_platform_state (GTK_EDITABLE (accessible), state);
* }
* ```
*
* Note that the widget which is the delegate *must* be a direct child of
* this widget, otherwise your implementation of [vfunc`Gtk`.Accessible.get_platform_state]
* might not even be called, as the platform change will originate from
* the parent of the delegate, and, as a result, will not work properly.
*
* So, if you can't ensure the direct child condition, you should give the
* delegate the %GTK_ACCESSIBLE_ROLE_TEXT_BOX role, or you can
* change your tree to allow this function to work.
* @param state what kind of accessible state to retrieve
* @returns the accessible platform state of the delegate
*/
delegate_get_accessible_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Deletes the currently selected text of the editable.
*
* This call doesnt do anything if there is no selected text.
*/
delete_selection(): void;
/**
* Deletes a sequence of characters.
*
* The characters that are deleted are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is
* negative, then the characters deleted are those from `start_pos` to
* the end of the text.
*
* Note that the positions are specified in characters, not bytes.
* @param start_pos start position
* @param end_pos end position
*/
delete_text(start_pos: number, end_pos: number): void;
/**
* Undoes the setup done by [method`Gtk`.Editable.init_delegate].
*
* This is a helper function that should be called from dispose,
* before removing the delegate object.
*/
finish_delegate(): void;
/**
* Gets the alignment of the editable.
* @returns the alignment
*/
get_alignment(): number;
/**
* Retrieves a sequence of characters.
*
* The characters that are retrieved are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is negative,
* then the characters retrieved are those characters from `start_pos` to
* the end of the text.
*
* Note that positions are specified in characters, not bytes.
* @param start_pos start of text
* @param end_pos end of text
* @returns a pointer to the contents of the widget as a string. This string is allocated by the `GtkEditable` implementation and should be freed by the caller.
*/
get_chars(start_pos: number, end_pos: number): string;
/**
* Gets the `GtkEditable` that `editable` is delegating its
* implementation to.
*
* Typically, the delegate is a [class`Gtk`.Text] widget.
* @returns the delegate `GtkEditable`
*/
get_delegate(): Gtk.Editable | null;
/**
* Retrieves whether `editable` is editable.
* @returns %TRUE if @editable is editable.
*/
get_editable(): boolean;
/**
* Gets if undo/redo actions are enabled for `editable`
* @returns %TRUE if undo is enabled
*/
get_enable_undo(): boolean;
/**
* Retrieves the desired maximum width of `editable,` in characters.
* @returns the maximum width of the entry, in characters
*/
get_max_width_chars(): number;
/**
* Retrieves the current position of the cursor relative
* to the start of the content of the editable.
*
* Note that this position is in characters, not in bytes.
* @returns the cursor position
*/
get_position(): number;
/**
* Retrieves the selection bound of the editable.
*
* `start_pos` will be filled with the start of the selection and
* `end_pos` with end. If no text was selected both will be identical
* and %FALSE will be returned.
*
* Note that positions are specified in characters, not bytes.
* @returns %TRUE if there is a non-empty selection, %FALSE otherwise
*/
get_selection_bounds(): [boolean, number, number];
/**
* Retrieves the contents of `editable`.
*
* The returned string is owned by GTK and must not be modified or freed.
* @returns a pointer to the contents of the editable
*/
get_text(): string;
/**
* Gets the number of characters of space reserved
* for the contents of the editable.
* @returns number of chars to request space for, or negative if unset
*/
get_width_chars(): number;
/**
* Sets up a delegate for `GtkEditable`.
*
* This is assuming that the get_delegate vfunc in the `GtkEditable`
* interface has been set up for the `editable'`s type.
*
* This is a helper function that should be called in instance init,
* after creating the delegate object.
*/
init_delegate(): void;
/**
* Inserts `length` bytes of `text` into the contents of the
* widget, at position `position`.
*
* Note that the position is in characters, not in bytes.
* The function updates `position` to point after the newly
* inserted text.
* @param text the text to insert
* @param length the length of the text in bytes, or -1
* @param position location of the position text will be inserted at
*/
insert_text(text: string, length: number, position: number): number;
/**
* Selects a region of text.
*
* The characters that are selected are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is
* negative, then the characters selected are those characters from
* `start_pos` to the end of the text.
*
* Note that positions are specified in characters, not bytes.
* @param start_pos start of region
* @param end_pos end of region
*/
select_region(start_pos: number, end_pos: number): void;
/**
* Sets the alignment for the contents of the editable.
*
* This controls the horizontal positioning of the contents when
* the displayed text is shorter than the width of the editable.
* @param xalign The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts
*/
set_alignment(xalign: number): void;
/**
* Determines if the user can edit the text in the editable widget.
* @param is_editable %TRUE if the user is allowed to edit the text in the widget
*/
set_editable(is_editable: boolean): void;
/**
* If enabled, changes to `editable` will be saved for undo/redo
* actions.
*
* This results in an additional copy of text changes and are not
* stored in secure memory. As such, undo is forcefully disabled
* when [property`Gtk`.Text:visibility] is set to %FALSE.
* @param enable_undo if undo/redo should be enabled
*/
set_enable_undo(enable_undo: boolean): void;
/**
* Sets the desired maximum width in characters of `editable`.
* @param n_chars the new desired maximum width, in characters
*/
set_max_width_chars(n_chars: number): void;
/**
* Sets the cursor position in the editable to the given value.
*
* The cursor is displayed before the character with the given (base 0)
* index in the contents of the editable. The value must be less than
* or equal to the number of characters in the editable. A value of -1
* indicates that the position should be set after the last character
* of the editable. Note that `position` is in characters, not in bytes.
* @param position the position of the cursor
*/
set_position(position: number): void;
/**
* Sets the text in the editable to the given value.
*
* This is replacing the current contents.
* @param text the text to set
*/
set_text(text: string): void;
/**
* Changes the size request of the editable to be about the
* right size for `n_chars` characters.
*
* Note that it changes the size request, the size can still
* be affected by how you pack the widget into containers.
* If `n_chars` is -1, the size reverts to the default size.
* @param n_chars width in chars
*/
set_width_chars(n_chars: number): void;
vfunc_changed(): void;
/**
* Deletes a sequence of characters.
*
* The characters that are deleted are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is
* negative, then the characters deleted are those from `start_pos` to
* the end of the text.
*
* Note that the positions are specified in characters, not bytes.
* @param start_pos start position
* @param end_pos end position
*/
vfunc_delete_text(start_pos: number, end_pos: number): void;
/**
* Deletes a sequence of characters.
*
* The characters that are deleted are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is
* negative, then the characters deleted are those from `start_pos` to
* the end of the text.
*
* Note that the positions are specified in characters, not bytes.
* @param start_pos start position
* @param end_pos end position
*/
vfunc_do_delete_text(start_pos: number, end_pos: number): void;
/**
* Inserts `length` bytes of `text` into the contents of the
* widget, at position `position`.
*
* Note that the position is in characters, not in bytes.
* The function updates `position` to point after the newly
* inserted text.
* @param text the text to insert
* @param length the length of the text in bytes, or -1
* @param position location of the position text will be inserted at
*/
vfunc_do_insert_text(text: string, length: number, position: number): number;
/**
* Gets the `GtkEditable` that `editable` is delegating its
* implementation to.
*
* Typically, the delegate is a [class`Gtk`.Text] widget.
*/
vfunc_get_delegate(): Gtk.Editable | null;
/**
* Retrieves the selection bound of the editable.
*
* `start_pos` will be filled with the start of the selection and
* `end_pos` with end. If no text was selected both will be identical
* and %FALSE will be returned.
*
* Note that positions are specified in characters, not bytes.
*/
vfunc_get_selection_bounds(): [boolean, number, number];
/**
* Retrieves the contents of `editable`.
*
* The returned string is owned by GTK and must not be modified or freed.
*/
vfunc_get_text(): string;
/**
* Inserts `length` bytes of `text` into the contents of the
* widget, at position `position`.
*
* Note that the position is in characters, not in bytes.
* The function updates `position` to point after the newly
* inserted text.
* @param text the text to insert
* @param length the length of the text in bytes, or -1
* @param position location of the position text will be inserted at
*/
vfunc_insert_text(text: string, length: number, position: number): number;
/**
* Selects a region of text.
*
* The characters that are selected are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is
* negative, then the characters selected are those characters from
* `start_pos` to the end of the text.
*
* Note that positions are specified in characters, not bytes.
* @param start_pos start of region
* @param end_pos end of region
*/
vfunc_set_selection_bounds(start_pos: number, end_pos: number): 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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace EnumListItem {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
name: string;
nick: string;
value: number;
}
}
/**
* `AdwEnumListItem` is the type of items in a [class`EnumListModel]`.
*/
class EnumListItem extends GObject.Object {
static $gtype: GObject.GType<EnumListItem>;
// Properties
/**
* The enum value name.
*/
get name(): string;
/**
* The enum value nick.
*/
get nick(): string;
/**
* The enum value.
*/
get value(): number;
// Constructors
constructor(properties?: Partial<EnumListItem.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
// Methods
/**
* Gets the enum value name.
* @returns the enum value name
*/
get_name(): string;
/**
* Gets the enum value nick.
* @returns the enum value nick
*/
get_nick(): string;
/**
* Gets the enum value.
* @returns the enum value
*/
get_value(): number;
}
namespace EnumListModel {
// Constructor properties interface
interface ConstructorProps<A extends GObject.Object = GObject.Object>
extends GObject.Object.ConstructorProps,
Gio.ListModel.ConstructorProps {
enum_type: GObject.GType;
enumType: GObject.GType;
}
}
/**
* A [iface`Gio`.ListModel] representing values of a given enum.
*
* `AdwEnumListModel` contains objects of type [class`EnumListItem]`.
*/
class EnumListModel<A extends GObject.Object = GObject.Object>
extends GObject.Object
implements Gio.ListModel<A>
{
static $gtype: GObject.GType<EnumListModel>;
// Properties
/**
* The type of the enum represented by the model.
*/
get enum_type(): GObject.GType;
/**
* The type of the enum represented by the model.
*/
get enumType(): GObject.GType;
// Constructors
constructor(properties?: Partial<EnumListModel.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](enum_type: GObject.GType): EnumListModel;
// Methods
/**
* Finds the position of a given enum value in `self`.
*
* If the value is not found, `GTK_INVALID_LIST_POSITION` is returned.
* @param value an enum value
* @returns the position of the value
*/
find_position(value: number): number;
/**
* Gets the type of the enum represented by `self`.
* @returns the enum type
*/
get_enum_type(): GObject.GType;
// Inherited methods
/**
* Gets the type of the items in `list`.
*
* All items returned from g_list_model_get_item() are of the type
* returned by this function, or a subtype, or if the type is an
* interface, they are an implementation of that interface.
*
* The item type of a #GListModel can not change during the life of the
* model.
* @returns the #GType of the items contained in @list.
*/
get_item_type(): GObject.GType;
/**
* Gets the number of items in `list`.
*
* Depending on the model implementation, calling this function may be
* less efficient than iterating the list with increasing values for
* `position` until g_list_model_get_item() returns %NULL.
* @returns the number of items in @list.
*/
get_n_items(): number;
/**
* Get the item at `position`.
*
* If `position` is greater than the number of items in `list,` %NULL is
* returned.
*
* %NULL is never returned for an index that is smaller than the length
* of the list.
*
* This function is meant to be used by language bindings in place
* of g_list_model_get_item().
*
* See also: g_list_model_get_n_items()
* @param position the position of the item to fetch
* @returns the object at @position.
*/
get_item(position: number): A | null;
/**
* Emits the #GListModel::items-changed signal on `list`.
*
* This function should only be called by classes implementing
* #GListModel. It has to be called after the internal representation
* of `list` has been updated, because handlers connected to this signal
* might query the new state of the list.
*
* Implementations must only make changes to the model (as visible to
* its consumer) in places that will not cause problems for that
* consumer. For models that are driven directly by a write API (such
* as #GListStore), changes can be reported in response to uses of that
* API. For models that represent remote data, changes should only be
* made from a fresh mainloop dispatch. It is particularly not
* permitted to make changes in response to a call to the #GListModel
* consumer API.
*
* Stated another way: in general, it is assumed that code making a
* series of accesses to the model via the API, without returning to the
* mainloop, and without calling other code, will continue to view the
* same contents of the model.
* @param position the position at which @list changed
* @param removed the number of items removed
* @param added the number of items added
*/
items_changed(position: number, removed: number, added: number): void;
/**
* Get the item at `position`. If `position` is greater than the number of
* items in `list,` %NULL is returned.
*
* %NULL is never returned for an index that is smaller than the length
* of the list. See g_list_model_get_n_items().
*
* The same #GObject instance may not appear more than once in a #GListModel.
* @param position the position of the item to fetch
*/
vfunc_get_item(position: number): A | null;
/**
* Gets the type of the items in `list`.
*
* All items returned from g_list_model_get_item() are of the type
* returned by this function, or a subtype, or if the type is an
* interface, they are an implementation of that interface.
*
* The item type of a #GListModel can not change during the life of the
* model.
*/
vfunc_get_item_type(): GObject.GType;
/**
* Gets the number of items in `list`.
*
* Depending on the model implementation, calling this function may be
* less efficient than iterating the list with increasing values for
* `position` until g_list_model_get_item() returns %NULL.
*/
vfunc_get_n_items(): 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 ExpanderRow {
// Constructor properties interface
interface ConstructorProps
extends PreferencesRow.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Actionable.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
enable_expansion: boolean;
enableExpansion: boolean;
expanded: boolean;
icon_name: string;
iconName: string;
show_enable_switch: boolean;
showEnableSwitch: boolean;
subtitle: string;
subtitle_lines: number;
subtitleLines: number;
title_lines: number;
titleLines: number;
}
}
/**
* A [class`Gtk`.ListBoxRow] used to reveal widgets.
*
* <picture>
* <source srcset="expander-row-dark.png" media="(prefers-color-scheme: dark)">
* <img src="expander-row.png" alt="expander-row">
* </picture>
*
* The `AdwExpanderRow` widget allows the user to reveal or hide widgets below
* it. It also allows the user to enable the expansion of the row, allowing to
* disable all that the row contains.
*
* ## AdwExpanderRow as GtkBuildable
*
* The `AdwExpanderRow` implementation of the [iface`Gtk`.Buildable] interface
* supports adding a child as an suffix widget by specifying “suffix” as the
* “type” attribute of a <child> element.
*
* It also supports adding it as a prefix widget by specifying “prefix” as the
* “type” attribute of a <child> element.
*
* ## CSS nodes
*
* `AdwExpanderRow` has a main CSS node with name `row` and the `.expander`
* style class. It has the `.empty` style class when it contains no children.
*
* It contains the subnodes `row.header` for its main embedded row,
* `list.nested` for the list it can expand, and `image.expander-row-arrow` for
* its arrow.
*
* ## Style classes
*
* `AdwExpanderRow` can use the [`.`](style-classes.html#property-rows)
* style class to emphasize the row subtitle instead of the row title, which is
* useful for displaying read-only properties.
*
* When used together with the `.monospace` style class, only the subtitle
* becomes monospace, not the title or any extra widgets.
*/
class ExpanderRow
extends PreferencesRow
implements Gtk.Accessible, Gtk.Actionable, Gtk.Buildable, Gtk.ConstraintTarget
{
static $gtype: GObject.GType<ExpanderRow>;
// Properties
/**
* Whether expansion is enabled.
*/
get enable_expansion(): boolean;
set enable_expansion(val: boolean);
/**
* Whether expansion is enabled.
*/
get enableExpansion(): boolean;
set enableExpansion(val: boolean);
/**
* Whether the row is expanded.
*/
get expanded(): boolean;
set expanded(val: boolean);
/**
* The icon name for this row.
*/
get icon_name(): string;
set icon_name(val: string);
/**
* The icon name for this row.
*/
get iconName(): string;
set iconName(val: string);
/**
* Whether the switch enabling the expansion is visible.
*/
get show_enable_switch(): boolean;
set show_enable_switch(val: boolean);
/**
* Whether the switch enabling the expansion is visible.
*/
get showEnableSwitch(): boolean;
set showEnableSwitch(val: boolean);
/**
* The subtitle for this row.
*
* The subtitle is interpreted as Pango markup unless
* [property`PreferencesRow:`use-markup] is set to `FALSE`.
*/
get subtitle(): string;
set subtitle(val: string);
/**
* The number of lines at the end of which the subtitle label will be
* ellipsized.
*
* If the value is 0, the number of lines won't be limited.
*/
get subtitle_lines(): number;
set subtitle_lines(val: number);
/**
* The number of lines at the end of which the subtitle label will be
* ellipsized.
*
* If the value is 0, the number of lines won't be limited.
*/
get subtitleLines(): number;
set subtitleLines(val: number);
/**
* The number of lines at the end of which the title label will be ellipsized.
*
* If the value is 0, the number of lines won't be limited.
*/
get title_lines(): number;
set title_lines(val: number);
/**
* The number of lines at the end of which the title label will be ellipsized.
*
* If the value is 0, the number of lines won't be limited.
*/
get titleLines(): number;
set titleLines(val: number);
// Constructors
constructor(properties?: Partial<ExpanderRow.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): ExpanderRow;
// Methods
/**
* Adds an action widget to `self`.
* @param widget a widget
*/
add_action(widget: Gtk.Widget): void;
/**
* Adds a prefix widget to `self`.
* @param widget a widget
*/
add_prefix(widget: Gtk.Widget): void;
/**
* Adds a widget to `self`.
*
* The widget will appear in the expanding list below `self`.
* @param child a widget
*/
add_row(child: Gtk.Widget): void;
/**
* Adds an suffix widget to `self`.
* @param widget a widget
*/
add_suffix(widget: Gtk.Widget): void;
/**
* Gets whether the expansion of `self` is enabled.
* @returns whether the expansion of @self is enabled.
*/
get_enable_expansion(): boolean;
/**
* Gets whether `self` is expanded.
* @returns whether @self is expanded
*/
get_expanded(): boolean;
/**
* Gets the icon name for `self`.
* @returns the icon name for @self
*/
get_icon_name(): string | null;
/**
* Gets whether the switch enabling the expansion of `self` is visible.
* @returns whether the switch enabling the expansion is visible
*/
get_show_enable_switch(): boolean;
/**
* Gets the subtitle for `self`.
* @returns the subtitle for @self
*/
get_subtitle(): string;
/**
* Gets the number of lines at the end of which the subtitle label will be
* ellipsized.
* @returns the number of lines at the end of which the subtitle label will be ellipsized
*/
get_subtitle_lines(): number;
/**
* Gets the number of lines at the end of which the title label will be
* ellipsized.
* @returns the number of lines at the end of which the title label will be ellipsized
*/
get_title_lines(): number;
/**
* Removes a child from `self`.
* @param child the child to be removed
*/
remove(child: Gtk.Widget): void;
/**
* Sets whether the expansion of `self` is enabled.
* @param enable_expansion whether to enable the expansion
*/
set_enable_expansion(enable_expansion: boolean): void;
/**
* Sets whether `self` is expanded.
* @param expanded whether to expand the row
*/
set_expanded(expanded: boolean): void;
/**
* Sets the icon name for `self`.
* @param icon_name the icon name
*/
set_icon_name(icon_name?: string | null): void;
/**
* Sets whether the switch enabling the expansion of `self` is visible.
* @param show_enable_switch whether to show the switch enabling the expansion
*/
set_show_enable_switch(show_enable_switch: boolean): void;
/**
* Sets the subtitle for `self`.
*
* The subtitle is interpreted as Pango markup unless
* [property`PreferencesRow:`use-markup] is set to `FALSE`.
* @param subtitle the subtitle
*/
set_subtitle(subtitle: string): void;
/**
* Sets the number of lines at the end of which the subtitle label will be
* ellipsized.
*
* If the value is 0, the number of lines won't be limited.
* @param subtitle_lines the number of lines at the end of which the subtitle label will be ellipsized
*/
set_subtitle_lines(subtitle_lines: number): void;
/**
* Sets the number of lines at the end of which the title label will be
* ellipsized.
*
* If the value is 0, the number of lines won't be limited.
* @param title_lines the number of lines at the end of which the title label will be ellipsized
*/
set_title_lines(title_lines: number): void;
// Inherited properties
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// 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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace Flap {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Swipeable.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Orientable.ConstructorProps {
content: Gtk.Widget;
flap: Gtk.Widget;
flap_position: Gtk.PackType;
flapPosition: Gtk.PackType;
fold_duration: number;
foldDuration: number;
fold_policy: FlapFoldPolicy;
foldPolicy: FlapFoldPolicy;
fold_threshold_policy: FoldThresholdPolicy;
foldThresholdPolicy: FoldThresholdPolicy;
folded: boolean;
locked: boolean;
modal: boolean;
reveal_flap: boolean;
revealFlap: boolean;
reveal_params: SpringParams;
revealParams: SpringParams;
reveal_progress: number;
revealProgress: number;
separator: Gtk.Widget;
swipe_to_close: boolean;
swipeToClose: boolean;
swipe_to_open: boolean;
swipeToOpen: boolean;
transition_type: FlapTransitionType;
transitionType: FlapTransitionType;
}
}
/**
* An adaptive container acting like a box or an overlay.
*
* <picture>
* <source srcset="flap-wide-dark.png" media="(prefers-color-scheme: dark)">
* <img src="flap-wide.png" alt="flap-wide">
* </picture>
* <picture>
* <source srcset="flap-narrow-dark.png" media="(prefers-color-scheme: dark)">
* <img src="flap-narrow.png" alt="flap-narrow">
* </picture>
*
* The `AdwFlap` widget can display its children like a [class`Gtk`.Box] does or
* like a [class`Gtk`.Overlay] does, according to the
* [property`Flap:`fold-policy] value.
*
* `AdwFlap` has at most three children: [property`Flap:`content],
* [property`Flap:`flap] and [property`Flap:`separator]. Content is the primary
* child, flap is displayed next to it when unfolded, or overlays it when
* folded. Flap can be shown or hidden by changing the
* [property`Flap:`reveal-flap] value, as well as via swipe gestures if
* [property`Flap:`swipe-to-open] and/or [property`Flap:`swipe-to-close] are set
* to `TRUE`.
*
* Optionally, a separator can be provided, which would be displayed between
* the content and the flap when there's no shadow to separate them, depending
* on the transition type.
*
* [property`Flap:`flap] is transparent by default; add the
* [`.background`](style-classes.html#background) style class to it if this is
* unwanted.
*
* If [property`Flap:`modal] is set to `TRUE`, content becomes completely
* inaccessible when the flap is revealed while folded.
*
* The position of the flap and separator children relative to the content is
* determined by orientation, as well as the [property`Flap:`flap-position]
* value.
*
* Folding the flap will automatically hide the flap widget, and unfolding it
* will automatically reveal it. If this behavior is not desired, the
* [property`Flap:`locked] property can be used to override it.
*
* Common use cases include sidebars, header bars that need to be able to
* overlap the window content (for example, in fullscreen mode) and bottom
* sheets.
*
* ## AdwFlap as GtkBuildable
*
* The `AdwFlap` implementation of the [iface`Gtk`.Buildable] interface supports
* setting the flap child by specifying “flap” as the “type” attribute of a
* `<child>` element, and separator by specifying “separator”. Specifying
* “content” child type or omitting it results in setting the content child.
*
* ## CSS nodes
*
* `AdwFlap` has a single CSS node with name `flap`. The node will get the style
* classes `.folded` when it is folded, and `.unfolded` when it's not.
*/
class Flap
extends Gtk.Widget
implements Swipeable, Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Orientable
{
static $gtype: GObject.GType<Flap>;
// Properties
/**
* The content widget.
*
* It's always displayed when unfolded, and partially visible when folded.
*/
get content(): Gtk.Widget;
set content(val: Gtk.Widget);
/**
* The flap widget.
*
* It's only visible when [property`Flap:`reveal-progress] is greater than 0.
*/
get flap(): Gtk.Widget;
set flap(val: Gtk.Widget);
/**
* The flap position.
*
* If it's set to `GTK_PACK_START`, the flap is displayed before the content,
* if `GTK_PACK_END`, it's displayed after the content.
*/
get flap_position(): Gtk.PackType;
set flap_position(val: Gtk.PackType);
/**
* The flap position.
*
* If it's set to `GTK_PACK_START`, the flap is displayed before the content,
* if `GTK_PACK_END`, it's displayed after the content.
*/
get flapPosition(): Gtk.PackType;
set flapPosition(val: Gtk.PackType);
/**
* The fold transition animation duration, in milliseconds.
*/
get fold_duration(): number;
set fold_duration(val: number);
/**
* The fold transition animation duration, in milliseconds.
*/
get foldDuration(): number;
set foldDuration(val: number);
/**
* The fold policy for the flap.
*/
get fold_policy(): FlapFoldPolicy;
set fold_policy(val: FlapFoldPolicy);
/**
* The fold policy for the flap.
*/
get foldPolicy(): FlapFoldPolicy;
set foldPolicy(val: FlapFoldPolicy);
/**
* Determines when the flap will fold.
*
* If set to `ADW_FOLD_THRESHOLD_POLICY_MINIMUM`, flap will only fold when
* the children cannot fit anymore. With `ADW_FOLD_THRESHOLD_POLICY_NATURAL`,
* it will fold as soon as children don't get their natural size.
*
* This can be useful if you have a long ellipsizing label and want to let it
* ellipsize instead of immediately folding.
*/
get fold_threshold_policy(): FoldThresholdPolicy;
set fold_threshold_policy(val: FoldThresholdPolicy);
/**
* Determines when the flap will fold.
*
* If set to `ADW_FOLD_THRESHOLD_POLICY_MINIMUM`, flap will only fold when
* the children cannot fit anymore. With `ADW_FOLD_THRESHOLD_POLICY_NATURAL`,
* it will fold as soon as children don't get their natural size.
*
* This can be useful if you have a long ellipsizing label and want to let it
* ellipsize instead of immediately folding.
*/
get foldThresholdPolicy(): FoldThresholdPolicy;
set foldThresholdPolicy(val: FoldThresholdPolicy);
/**
* Whether the flap is currently folded.
*
* See [property`Flap:`fold-policy].
*/
get folded(): boolean;
/**
* Whether the flap is locked.
*
* If `FALSE`, folding when the flap is revealed automatically closes it, and
* unfolding it when the flap is not revealed opens it. If `TRUE`,
* [property`Flap:`reveal-flap] value never changes on its own.
*/
get locked(): boolean;
set locked(val: boolean);
/**
* Whether the flap is modal.
*
* If `TRUE`, clicking the content widget while flap is revealed, as well as
* pressing the <kbd>Esc</kbd> key, will close the flap. If `FALSE`, clicks
* are passed through to the content widget.
*/
get modal(): boolean;
set modal(val: boolean);
/**
* Whether the flap widget is revealed.
*/
get reveal_flap(): boolean;
set reveal_flap(val: boolean);
/**
* Whether the flap widget is revealed.
*/
get revealFlap(): boolean;
set revealFlap(val: boolean);
/**
* The reveal animation spring parameters.
*
* The default value is equivalent to:
*
* ```c
* adw_spring_params_new (1, 0.5, 500)
* ```
*/
get reveal_params(): SpringParams;
set reveal_params(val: SpringParams);
/**
* The reveal animation spring parameters.
*
* The default value is equivalent to:
*
* ```c
* adw_spring_params_new (1, 0.5, 500)
* ```
*/
get revealParams(): SpringParams;
set revealParams(val: SpringParams);
/**
* The current reveal transition progress.
*
* 0 means fully hidden, 1 means fully revealed.
*
* See [property`Flap:`reveal-flap].
*/
get reveal_progress(): number;
/**
* The current reveal transition progress.
*
* 0 means fully hidden, 1 means fully revealed.
*
* See [property`Flap:`reveal-flap].
*/
get revealProgress(): number;
/**
* The separator widget.
*
* It's displayed between content and flap when there's no shadow to display.
* When exactly it's visible depends on the [property`Flap:`transition-type]
* value.
*/
get separator(): Gtk.Widget;
set separator(val: Gtk.Widget);
/**
* Whether the flap can be closed with a swipe gesture.
*
* The area that can be swiped depends on the [property`Flap:`transition-type]
* value.
*/
get swipe_to_close(): boolean;
set swipe_to_close(val: boolean);
/**
* Whether the flap can be closed with a swipe gesture.
*
* The area that can be swiped depends on the [property`Flap:`transition-type]
* value.
*/
get swipeToClose(): boolean;
set swipeToClose(val: boolean);
/**
* Whether the flap can be opened with a swipe gesture.
*
* The area that can be swiped depends on the [property`Flap:`transition-type]
* value.
*/
get swipe_to_open(): boolean;
set swipe_to_open(val: boolean);
/**
* Whether the flap can be opened with a swipe gesture.
*
* The area that can be swiped depends on the [property`Flap:`transition-type]
* value.
*/
get swipeToOpen(): boolean;
set swipeToOpen(val: boolean);
/**
* the type of animation used for reveal and fold transitions.
*
* [property`Flap:`flap] is transparent by default, which means the content
* will be seen through it with `ADW_FLAP_TRANSITION_TYPE_OVER` transitions;
* add the [`.background`](style-classes.html#background) style class to it if
* this is unwanted.
*/
get transition_type(): FlapTransitionType;
set transition_type(val: FlapTransitionType);
/**
* the type of animation used for reveal and fold transitions.
*
* [property`Flap:`flap] is transparent by default, which means the content
* will be seen through it with `ADW_FLAP_TRANSITION_TYPE_OVER` transitions;
* add the [`.background`](style-classes.html#background) style class to it if
* this is unwanted.
*/
get transitionType(): FlapTransitionType;
set transitionType(val: FlapTransitionType);
// Constructors
constructor(properties?: Partial<Flap.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): Flap;
// Methods
/**
* Gets the content widget for `self`.
* @returns the content widget for @self
*/
get_content(): Gtk.Widget | null;
/**
* Gets the flap widget for `self`.
* @returns the flap widget for @self
*/
get_flap(): Gtk.Widget | null;
/**
* Gets the flap position for `self`.
* @returns the flap position for @self
*/
get_flap_position(): Gtk.PackType;
/**
* Gets the fold transition animation duration for `self,` in milliseconds.
* @returns the fold transition duration
*/
get_fold_duration(): number;
/**
* Gets the fold policy for `self`.
* @returns the fold policy for @self
*/
get_fold_policy(): FlapFoldPolicy;
/**
* Gets the fold threshold policy for `self`.
* @returns the fold threshold policy
*/
get_fold_threshold_policy(): FoldThresholdPolicy;
/**
* Gets whether `self` is currently folded.
*
* See [property`Flap:`fold-policy].
* @returns `TRUE` if @self is currently folded
*/
get_folded(): boolean;
/**
* Gets whether `self` is locked.
* @returns `TRUE` if @self is locked
*/
get_locked(): boolean;
/**
* Gets whether `self` is modal.
* @returns `TRUE` if @self is modal
*/
get_modal(): boolean;
/**
* Gets whether the flap widget is revealed for `self`.
* @returns `TRUE` if the flap widget is revealed
*/
get_reveal_flap(): boolean;
/**
* Gets the reveal animation spring parameters for `self`.
* @returns the reveal animation parameters
*/
get_reveal_params(): SpringParams;
/**
* Gets the current reveal progress for `self`.
*
* 0 means fully hidden, 1 means fully revealed.
*
* See [property`Flap:`reveal-flap].
* @returns the current reveal progress for @self
*/
get_reveal_progress(): number;
/**
* Gets the separator widget for `self`.
* @returns the separator widget for @self
*/
get_separator(): Gtk.Widget | null;
/**
* Gets whether `self` can be closed with a swipe gesture.
* @returns `TRUE` if @self can be closed with a swipe gesture
*/
get_swipe_to_close(): boolean;
/**
* Gets whether `self` can be opened with a swipe gesture.
* @returns `TRUE` if @self can be opened with a swipe gesture
*/
get_swipe_to_open(): boolean;
/**
* Gets the type of animation used for reveal and fold transitions in `self`.
* @returns the current transition type of @self
*/
get_transition_type(): FlapTransitionType;
/**
* Sets the content widget for `self`.
*
* It's always displayed when unfolded, and partially visible when folded.
* @param content the content widget
*/
set_content(content?: Gtk.Widget | null): void;
/**
* Sets the flap widget for `self`.
*
* It's only visible when [property`Flap:`reveal-progress] is greater than 0.
* @param flap the flap widget
*/
set_flap(flap?: Gtk.Widget | null): void;
/**
* Sets the flap position for `self`.
*
* If it's set to `GTK_PACK_START`, the flap is displayed before the content,
* if `GTK_PACK_END`, it's displayed after the content.
* @param position the new value
*/
set_flap_position(position: Gtk.PackType | null): void;
/**
* Sets the fold transition animation duration for `self,` in milliseconds.
* @param duration the new duration, in milliseconds
*/
set_fold_duration(duration: number): void;
/**
* Sets the fold policy for `self`.
* @param policy the fold policy
*/
set_fold_policy(policy: FlapFoldPolicy | null): void;
/**
* Sets the fold threshold policy for `self`.
*
* If set to `ADW_FOLD_THRESHOLD_POLICY_MINIMUM`, flap will only fold when the
* children cannot fit anymore. With `ADW_FOLD_THRESHOLD_POLICY_NATURAL`, it
* will fold as soon as children don't get their natural size.
*
* This can be useful if you have a long ellipsizing label and want to let it
* ellipsize instead of immediately folding.
* @param policy the policy to use
*/
set_fold_threshold_policy(policy: FoldThresholdPolicy | null): void;
/**
* Sets whether `self` is locked.
*
* If `FALSE`, folding when the flap is revealed automatically closes it, and
* unfolding it when the flap is not revealed opens it. If `TRUE`,
* [property`Flap:`reveal-flap] value never changes on its own.
* @param locked the new value
*/
set_locked(locked: boolean): void;
/**
* Sets whether `self` is modal.
*
* If `TRUE`, clicking the content widget while flap is revealed, as well as
* pressing the <kbd>Esc</kbd> key, will close the flap. If `FALSE`, clicks are
* passed through to the content widget.
* @param modal whether @self is modal
*/
set_modal(modal: boolean): void;
/**
* Sets whether the flap widget is revealed for `self`.
* @param reveal_flap whether to reveal the flap widget
*/
set_reveal_flap(reveal_flap: boolean): void;
/**
* Sets the reveal animation spring parameters for `self`.
*
* The default value is equivalent to:
*
* ```c
* adw_spring_params_new (1, 0.5, 500)
* ```
* @param params the new parameters
*/
set_reveal_params(params: SpringParams): void;
/**
* Sets the separator widget for `self`.
*
* It's displayed between content and flap when there's no shadow to display.
* When exactly it's visible depends on the [property`Flap:`transition-type]
* value.
* @param separator the separator widget
*/
set_separator(separator?: Gtk.Widget | null): void;
/**
* Sets whether `self` can be closed with a swipe gesture.
*
* The area that can be swiped depends on the [property`Flap:`transition-type]
* value.
* @param swipe_to_close whether @self can be closed with a swipe gesture
*/
set_swipe_to_close(swipe_to_close: boolean): void;
/**
* Sets whether `self` can be opened with a swipe gesture.
*
* The area that can be swiped depends on the [property`Flap:`transition-type]
* value.
* @param swipe_to_open whether @self can be opened with a swipe gesture
*/
set_swipe_to_open(swipe_to_open: boolean): void;
/**
* Sets the type of animation used for reveal and fold transitions in `self`.
*
* [property`Flap:`flap] is transparent by default, which means the content will
* be seen through it with `ADW_FLAP_TRANSITION_TYPE_OVER` transitions; add the
* [`.background`](style-classes.html#background) style class to it if this is
* unwanted.
* @param transition_type the new transition type
*/
set_transition_type(transition_type: FlapTransitionType | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* The orientation of the orientable.
*/
get orientation(): Gtk.Orientation;
set orientation(val: Gtk.Orientation);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// Inherited methods
/**
* Gets the progress `self` will snap back to after the gesture is canceled.
* @returns the cancel progress, unitless
*/
get_cancel_progress(): number;
/**
* Gets the swipe distance of `self`.
*
* This corresponds to how many pixels 1 unit represents.
* @returns the swipe distance in pixels
*/
get_distance(): number;
/**
* Gets the current progress of `self`.
* @returns the current progress, unitless
*/
get_progress(): number;
/**
* Gets the snap points of `self`.
*
* Each snap point represents a progress value that is considered acceptable to
* end the swipe on.
* @returns the snap points
*/
get_snap_points(): number[];
/**
* Gets the area `self` can start a swipe from for the given direction and
* gesture type.
*
* This can be used to restrict swipes to only be possible from a certain area,
* for example, to only allow edge swipes, or to have a draggable element and
* ignore swipes elsewhere.
*
* If not implemented, the default implementation returns the allocation of
* `self,` allowing swipes from anywhere.
* @param navigation_direction the direction of the swipe
* @param is_drag whether the swipe is caused by a dragging gesture
*/
get_swipe_area(navigation_direction: NavigationDirection | null, is_drag: boolean): Gdk.Rectangle;
/**
* Gets the progress `self` will snap back to after the gesture is canceled.
*/
vfunc_get_cancel_progress(): number;
/**
* Gets the swipe distance of `self`.
*
* This corresponds to how many pixels 1 unit represents.
*/
vfunc_get_distance(): number;
/**
* Gets the current progress of `self`.
*/
vfunc_get_progress(): number;
/**
* Gets the snap points of `self`.
*
* Each snap point represents a progress value that is considered acceptable to
* end the swipe on.
*/
vfunc_get_snap_points(): number[];
/**
* Gets the area `self` can start a swipe from for the given direction and
* gesture type.
*
* This can be used to restrict swipes to only be possible from a certain area,
* for example, to only allow edge swipes, or to have a draggable element and
* ignore swipes elsewhere.
*
* If not implemented, the default implementation returns the allocation of
* `self,` allowing swipes from anywhere.
* @param navigation_direction the direction of the swipe
* @param is_drag whether the swipe is caused by a dragging gesture
*/
vfunc_get_swipe_area(navigation_direction: NavigationDirection, is_drag: boolean): Gdk.Rectangle;
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: string): void;
/**
* Retrieves the orientation of the `orientable`.
* @returns the orientation of the @orientable
*/
get_orientation(): Gtk.Orientation;
/**
* Sets the orientation of the `orientable`.
* @param orientation the orientables new orientation
*/
set_orientation(orientation: Gtk.Orientation | null): void;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): 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 HeaderBar {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
centering_policy: CenteringPolicy;
centeringPolicy: CenteringPolicy;
decoration_layout: string;
decorationLayout: string;
show_back_button: boolean;
showBackButton: boolean;
show_end_title_buttons: boolean;
showEndTitleButtons: boolean;
show_start_title_buttons: boolean;
showStartTitleButtons: boolean;
show_title: boolean;
showTitle: boolean;
title_widget: Gtk.Widget;
titleWidget: Gtk.Widget;
}
}
/**
* A title bar widget.
*
* <picture>
* <source srcset="header-bar-dark.png" media="(prefers-color-scheme: dark)">
* <img src="header-bar.png" alt="header-bar">
* </picture>
*
* `AdwHeaderBar` is similar to [class`Gtk`.HeaderBar], but provides additional
* features compared to it. Refer to `GtkHeaderBar` for details. It is typically
* used as a top bar within [class`ToolbarView]`.
*
* ## Dialog Integration
*
* When placed inside an [class`Dialog]`, `AdwHeaderBar` will display the dialog
* title instead of window title. It will also adjust the decoration layout to
* ensure it always has a close button and nothing else. Set
* [property`HeaderBar:`show-start-title-buttons] and
* [property`HeaderBar:`show-end-title-buttons] to `FALSE` to remove it if it's
* unwanted.
*
* ## Navigation View Integration
*
* When placed inside an [class`NavigationPage]`, `AdwHeaderBar` will display the
* page title instead of window title.
*
* When used together with [class`NavigationView]` or [class`NavigationSplitView]`,
* it will also display a back button that can be used to go back to the previous
* page. The button also has a context menu, allowing to pop multiple pages at
* once, potentially across multiple navigation views.
*
* Set [property`HeaderBar:`show-back-button] to `FALSE` to disable this behavior
* in rare scenarios where it's unwanted.
*
* ## Split View Integration
*
* When placed inside [class`NavigationSplitView]` or [class`OverlaySplitView]`,
* `AdwHeaderBar` will automatically hide the title buttons other than at the
* edges of the window.
*
* ## Bottom Sheet Integration
*
* When played inside [class`BottomSheet]`, `AdwHeaderBar` will not show the title
* unless [property`BottomSheet:`show-drag-handle] is set to `FALSE`, regardless
* of [property`HeaderBar:`show-title]. This only applies to the default title,
* titles set with [property`HeaderBar:`title-widget] will still be shown.
*
* ## Centering Policy
*
* [property`HeaderBar:`centering-policy] allows to enforce strict centering of
* the title widget. This can be useful for entries inside [class`Clamp]`.
*
* ## Title Buttons
*
* Unlike `GtkHeaderBar`, `AdwHeaderBar` allows to toggle title button
* visibility for each side individually, using the
* [property`HeaderBar:`show-start-title-buttons] and
* [property`HeaderBar:`show-end-title-buttons] properties.
*
* ## CSS nodes
*
* ```
* headerbar
* ╰── windowhandle
* ╰── box
* ├── widget
* │ ╰── box.start
* │ ├── windowcontrols.start
* │ ├── widget
* │ │ ╰── [button.back]
* │ ╰── [other children]
* ├── widget
* │ ╰── [Title Widget]
* ╰── widget
* ╰── box.end
* ├── [other children]
* ╰── windowcontrols.end
* ```
*
* `AdwHeaderBar`'s CSS node is called `headerbar`. It contains a `windowhandle`
* subnode, which contains a `box` subnode, which contains three `widget`
* subnodes at the start, center and end of the header bar. The start and end
* subnodes contain a `box` subnode with the `.start` and `.end` style classes
* respectively, and the center node contains a node that represents the title.
*
* Each of the boxes contains a `windowcontrols` subnode, see
* [class`Gtk`.WindowControls] for details, as well as other children.
*
* When [property`HeaderBar:`show-back-button] is `TRUE`, the start box also
* contains a node with the name `widget` that contains a node with the name
* `button` and `.back` style class.
*
* ## Accessibility
*
* `AdwHeaderBar` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.
*/
class HeaderBar extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<HeaderBar>;
// Properties
/**
* The policy for aligning the center widget.
*/
get centering_policy(): CenteringPolicy;
set centering_policy(val: CenteringPolicy);
/**
* The policy for aligning the center widget.
*/
get centeringPolicy(): CenteringPolicy;
set centeringPolicy(val: CenteringPolicy);
/**
* The decoration layout for buttons.
*
* If this property is not set, the
* [property`Gtk`.Settings:gtk-decoration-layout] setting is used.
*
* The format of the string is button names, separated by commas. A colon
* separates the buttons that should appear at the start from those at the
* end. Recognized button names are minimize, maximize, close and icon (the
* window icon).
*
* For example, “icon:minimize,maximize,close” specifies an icon at the start,
* and minimize, maximize and close buttons at the end.
*/
get decoration_layout(): string;
set decoration_layout(val: string);
/**
* The decoration layout for buttons.
*
* If this property is not set, the
* [property`Gtk`.Settings:gtk-decoration-layout] setting is used.
*
* The format of the string is button names, separated by commas. A colon
* separates the buttons that should appear at the start from those at the
* end. Recognized button names are minimize, maximize, close and icon (the
* window icon).
*
* For example, “icon:minimize,maximize,close” specifies an icon at the start,
* and minimize, maximize and close buttons at the end.
*/
get decorationLayout(): string;
set decorationLayout(val: string);
/**
* Whether the header bar can show the back button.
*
* The back button will never be shown unless the header bar is placed inside an
* [class`NavigationView]`. Usually, there is no reason to set this to `FALSE`.
*/
get show_back_button(): boolean;
set show_back_button(val: boolean);
/**
* Whether the header bar can show the back button.
*
* The back button will never be shown unless the header bar is placed inside an
* [class`NavigationView]`. Usually, there is no reason to set this to `FALSE`.
*/
get showBackButton(): boolean;
set showBackButton(val: boolean);
/**
* Whether to show title buttons at the end of the header bar.
*
* See [property`HeaderBar:`show-start-title-buttons] for the other side.
*
* Which buttons are actually shown and where is determined by the
* [property`HeaderBar:`decoration-layout] property, and by the state of the
* window (e.g. a close button will not be shown if the window can't be
* closed).
*/
get show_end_title_buttons(): boolean;
set show_end_title_buttons(val: boolean);
/**
* Whether to show title buttons at the end of the header bar.
*
* See [property`HeaderBar:`show-start-title-buttons] for the other side.
*
* Which buttons are actually shown and where is determined by the
* [property`HeaderBar:`decoration-layout] property, and by the state of the
* window (e.g. a close button will not be shown if the window can't be
* closed).
*/
get showEndTitleButtons(): boolean;
set showEndTitleButtons(val: boolean);
/**
* Whether to show title buttons at the start of the header bar.
*
* See [property`HeaderBar:`show-end-title-buttons] for the other side.
*
* Which buttons are actually shown and where is determined by the
* [property`HeaderBar:`decoration-layout] property, and by the state of the
* window (e.g. a close button will not be shown if the window can't be
* closed).
*/
get show_start_title_buttons(): boolean;
set show_start_title_buttons(val: boolean);
/**
* Whether to show title buttons at the start of the header bar.
*
* See [property`HeaderBar:`show-end-title-buttons] for the other side.
*
* Which buttons are actually shown and where is determined by the
* [property`HeaderBar:`decoration-layout] property, and by the state of the
* window (e.g. a close button will not be shown if the window can't be
* closed).
*/
get showStartTitleButtons(): boolean;
set showStartTitleButtons(val: boolean);
/**
* Whether the title widget should be shown.
*/
get show_title(): boolean;
set show_title(val: boolean);
/**
* Whether the title widget should be shown.
*/
get showTitle(): boolean;
set showTitle(val: boolean);
/**
* The title widget to display.
*
* When set to `NULL`, the header bar will display the title of the window it
* is contained in.
*
* To use a different title, use [class`WindowTitle]`:
*
* ```xml
* <object class="AdwHeaderBar">
* <property name="title-widget">
* <object class="AdwWindowTitle">
* <property name="title" translatable="yes">Title</property>
* </object>
* </property>
* </object>
* ```
*/
get title_widget(): Gtk.Widget;
set title_widget(val: Gtk.Widget);
/**
* The title widget to display.
*
* When set to `NULL`, the header bar will display the title of the window it
* is contained in.
*
* To use a different title, use [class`WindowTitle]`:
*
* ```xml
* <object class="AdwHeaderBar">
* <property name="title-widget">
* <object class="AdwWindowTitle">
* <property name="title" translatable="yes">Title</property>
* </object>
* </property>
* </object>
* ```
*/
get titleWidget(): Gtk.Widget;
set titleWidget(val: Gtk.Widget);
// Constructors
constructor(properties?: Partial<HeaderBar.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): HeaderBar;
// Methods
/**
* Gets the policy for aligning the center widget.
* @returns the centering policy
*/
get_centering_policy(): CenteringPolicy;
/**
* Gets the decoration layout for `self`.
* @returns the decoration layout
*/
get_decoration_layout(): string | null;
/**
* Gets whether `self` can show the back button.
* @returns whether to show the back button
*/
get_show_back_button(): boolean;
/**
* Gets whether to show title buttons at the end of `self`.
* @returns `TRUE` if title buttons at the end are shown
*/
get_show_end_title_buttons(): boolean;
/**
* Gets whether to show title buttons at the start of `self`.
* @returns `TRUE` if title buttons at the start are shown
*/
get_show_start_title_buttons(): boolean;
/**
* Gets whether the title widget should be shown.
* @returns whether the title widget should be shown.
*/
get_show_title(): boolean;
/**
* Gets the title widget widget of `self`.
* @returns the title widget
*/
get_title_widget(): Gtk.Widget | null;
/**
* Adds `child` to `self,` packed with reference to the end of `self`.
* @param child the widget to be added to @self
*/
pack_end(child: Gtk.Widget): void;
/**
* Adds `child` to `self,` packed with reference to the start of the `self`.
* @param child the widget to be added to @self
*/
pack_start(child: Gtk.Widget): void;
/**
* Removes a child from `self`.
*
* The child must have been added with [method`HeaderBar`.pack_start],
* [method`HeaderBar`.pack_end] or [property`HeaderBar:`title-widget].
* @param child the child to remove
*/
remove(child: Gtk.Widget): void;
/**
* Sets the policy for aligning the center widget.
* @param centering_policy the centering policy
*/
set_centering_policy(centering_policy: CenteringPolicy | null): void;
/**
* Sets the decoration layout for `self`.
*
* If this property is not set, the
* [property`Gtk`.Settings:gtk-decoration-layout] setting is used.
*
* The format of the string is button names, separated by commas. A colon
* separates the buttons that should appear at the start from those at the end.
* Recognized button names are minimize, maximize, close and icon (the window
* icon).
*
* For example, “icon:minimize,maximize,close” specifies an icon at the start,
* and minimize, maximize and close buttons at the end.
* @param layout a decoration layout
*/
set_decoration_layout(layout?: string | null): void;
/**
* Sets whether `self` can show the back button.
*
* The back button will never be shown unless the header bar is placed inside an
* [class`NavigationView]`. Usually, there is no reason to set it to `FALSE`.
* @param show_back_button whether to show the back button
*/
set_show_back_button(show_back_button: boolean): void;
/**
* Sets whether to show title buttons at the end of `self`.
*
* See [property`HeaderBar:`show-start-title-buttons] for the other side.
*
* Which buttons are actually shown and where is determined by the
* [property`HeaderBar:`decoration-layout] property, and by the state of the
* window (e.g. a close button will not be shown if the window can't be closed).
* @param setting `TRUE` to show standard title buttons
*/
set_show_end_title_buttons(setting: boolean): void;
/**
* Sets whether to show title buttons at the start of `self`.
*
* See [property`HeaderBar:`show-end-title-buttons] for the other side.
*
* Which buttons are actually shown and where is determined by the
* [property`HeaderBar:`decoration-layout] property, and by the state of the
* window (e.g. a close button will not be shown if the window can't be closed).
* @param setting `TRUE` to show standard title buttons
*/
set_show_start_title_buttons(setting: boolean): void;
/**
* Sets whether the title widget should be shown.
* @param show_title whether the title widget is visible
*/
set_show_title(show_title: boolean): void;
/**
* Sets the title widget for `self`.
*
* When set to `NULL`, the header bar will display the title of the window it
* is contained in.
*
* To use a different title, use [class`WindowTitle]`:
*
* ```xml
* <object class="AdwHeaderBar">
* <property name="title-widget">
* <object class="AdwWindowTitle">
* <property name="title" translatable="yes">Title</property>
* </object>
* </property>
* </object>
* ```
* @param title_widget a widget to use for a title
*/
set_title_widget(title_widget?: Gtk.Widget | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 InlineViewSwitcher {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Orientable.ConstructorProps {
can_shrink: boolean;
canShrink: boolean;
display_mode: InlineViewSwitcherDisplayMode;
displayMode: InlineViewSwitcherDisplayMode;
homogeneous: boolean;
stack: ViewStack;
}
}
/**
* A view switcher that uses a toggle group.
*
* <picture>
* <source srcset="inline-view-switcher-dark.png" media="(prefers-color-scheme: dark)">
* <img src="inline-view-switcher.png" alt="inline-view-switcher">
* </picture>
*
* A view switcher showing pages of an [class`ViewStack]` within an
* [class`ToggleGroup]`, similar to [class`ViewSwitcher]`.
*
* The toggles can display either an icon, a label or both. Use the
* [property`InlineViewSwitcher:`display-mode] to control this.
*
* <picture>
* <source srcset="inline-view-switcher-display-modes-dark.png" media="(prefers-color-scheme: dark)">
* <img src="inline-view-switcher-display-modes.png" alt="inline-view-switcher-display-modes">
* </picture>
*
* ## CSS nodes
*
* `AdwInlineViewSwitcher` has a single CSS node with the name
* `inline-view-switcher`.
*
* ## Style classes
*
* Like `AdwToggleGroup`, it can accept the [`.flat`](style-classes.html#flat_1)
* and [`.round`](style-classes.html#round) style classes.
*
* <picture>
* <source srcset="inline-view-switcher-style-classes-dark.png" media="(prefers-color-scheme: dark)">
* <img src="inline-view-switcher-style-classes.png" alt="inline-view-switcher-style-classes">
* </picture>
*
* ## Accessibility
*
* The internal toggle group uses the `GTK_ACCESSIBLE_ROLE_TAB_LIST` role. Its
* toggles use the `GTK_ACCESSIBLE_ROLE_TAB` role.
*/
class InlineViewSwitcher
extends Gtk.Widget
implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Orientable
{
static $gtype: GObject.GType<InlineViewSwitcher>;
// Properties
/**
* Whether the toggles can be smaller than the natural size of their contents.
*
* If set to `TRUE`, the toggle labels will ellipsize.
*
* See [property`ToggleGroup:`can-shrink].
*/
get can_shrink(): boolean;
set can_shrink(val: boolean);
/**
* Whether the toggles can be smaller than the natural size of their contents.
*
* If set to `TRUE`, the toggle labels will ellipsize.
*
* See [property`ToggleGroup:`can-shrink].
*/
get canShrink(): boolean;
set canShrink(val: boolean);
/**
* The display mode.
*
* Determines what the toggles display: a label, an icon or both.
*
* <picture>
* <source srcset="inline-view-switcher-display-modes-dark.png" media="(prefers-color-scheme: dark)">
* <img src="inline-view-switcher-display-modes.png" alt="inline-view-switcher-display-modes">
* </picture>
*/
get display_mode(): InlineViewSwitcherDisplayMode;
set display_mode(val: InlineViewSwitcherDisplayMode);
/**
* The display mode.
*
* Determines what the toggles display: a label, an icon or both.
*
* <picture>
* <source srcset="inline-view-switcher-display-modes-dark.png" media="(prefers-color-scheme: dark)">
* <img src="inline-view-switcher-display-modes.png" alt="inline-view-switcher-display-modes">
* </picture>
*/
get displayMode(): InlineViewSwitcherDisplayMode;
set displayMode(val: InlineViewSwitcherDisplayMode);
/**
* Whether all toggles take the same size.
*/
get homogeneous(): boolean;
set homogeneous(val: boolean);
/**
* The stack the view switcher controls.
*/
get stack(): ViewStack;
set stack(val: ViewStack);
// Constructors
constructor(properties?: Partial<InlineViewSwitcher.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): InlineViewSwitcher;
// Methods
/**
* Gets whether the toggles can be smaller than the natural size of their
* contents.
* @returns whether the toggles can shrink
*/
get_can_shrink(): boolean;
/**
* Gets the display mode of `self`.
* @returns the display mode
*/
get_display_mode(): InlineViewSwitcherDisplayMode;
/**
* Gets whether all toggles within `self` take the same size.
* @returns whether all toggles take the same size
*/
get_homogeneous(): boolean;
/**
* Gets the stack `self` controls.
* @returns The stack of @self
*/
get_stack(): ViewStack | null;
/**
* Sets whether the toggles can be smaller than the natural size of their
* contents.
*
* If `can_shrink` is `TRUE`, the toggle labels will ellipsize.
*
* See [property`ToggleGroup:`can-shrink].
* @param can_shrink whether the toggles can shrink
*/
set_can_shrink(can_shrink: boolean): void;
/**
* Sets the display mode of `self`.
*
* Determines what the toggles display: a label, an icon or both.
*
* <picture>
* <source srcset="inline-view-switcher-display-modes-dark.png" media="(prefers-color-scheme: dark)">
* <img src="inline-view-switcher-display-modes.png" alt="inline-view-switcher-display-modes">
* </picture>
* @param mode the display mode
*/
set_display_mode(mode: InlineViewSwitcherDisplayMode | null): void;
/**
* Sets whether all toggles within `self` take the same size.
* @param homogeneous whether all toggles should take the same size
*/
set_homogeneous(homogeneous: boolean): void;
/**
* Sets the stack to control.
* @param stack a stack
*/
set_stack(stack?: ViewStack | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* The orientation of the orientable.
*/
get orientation(): Gtk.Orientation;
set orientation(val: Gtk.Orientation);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: string): void;
/**
* Retrieves the orientation of the `orientable`.
* @returns the orientation of the @orientable
*/
get_orientation(): Gtk.Orientation;
/**
* Sets the orientation of the `orientable`.
* @param orientation the orientables new orientation
*/
set_orientation(orientation: Gtk.Orientation | null): 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 Layout {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, Gtk.Buildable.ConstructorProps {
content: Gtk.Widget;
name: string;
}
}
/**
* An individual layout in [class`MultiLayoutView]`.
*/
class Layout extends GObject.Object implements Gtk.Buildable {
static $gtype: GObject.GType<Layout>;
// Properties
/**
* The content widget.
*/
get content(): Gtk.Widget;
/**
* The name of the layout.
*/
get name(): string;
set name(val: string);
// Constructors
constructor(properties?: Partial<Layout.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](content: Gtk.Widget): Layout;
// Methods
/**
* Gets the content widget.
* @returns The content
*/
get_content(): Gtk.Widget;
/**
* Gets the name of the layout.
* @returns the name of the layout
*/
get_name(): string | null;
/**
* Sets the name of the layout.
* @param name the layout name
*/
set_name(name?: string | null): void;
// Inherited methods
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 LayoutSlot {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
id: string;
}
}
/**
* A child slot within [class`Layout]`.
*
* While it contains a layout child, the [property`Gtk`.Widget:visible] property
* of the slot is updated to match that of the layout child.
*
* See [class`MultiLayoutView]`.
*/
class LayoutSlot extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<LayoutSlot>;
// Properties
/**
* The slot ID.
*
* See [method`MultiLayoutView`.set_child].
*/
get id(): string;
// Constructors
constructor(properties?: Partial<LayoutSlot.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](id: string): LayoutSlot;
// Methods
/**
* Gets the slot id of `self`.
* @returns the slot ID
*/
get_slot_id(): string;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 Leaflet {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Swipeable.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Orientable.ConstructorProps {
can_navigate_back: boolean;
canNavigateBack: boolean;
can_navigate_forward: boolean;
canNavigateForward: boolean;
can_unfold: boolean;
canUnfold: boolean;
child_transition_params: SpringParams;
childTransitionParams: SpringParams;
child_transition_running: boolean;
childTransitionRunning: boolean;
fold_threshold_policy: FoldThresholdPolicy;
foldThresholdPolicy: FoldThresholdPolicy;
folded: boolean;
homogeneous: boolean;
mode_transition_duration: number;
modeTransitionDuration: number;
pages: Gtk.SelectionModel;
transition_type: LeafletTransitionType;
transitionType: LeafletTransitionType;
visible_child: Gtk.Widget;
visibleChild: Gtk.Widget;
visible_child_name: string;
visibleChildName: string;
}
}
/**
* An adaptive container acting like a box or a stack.
*
* <picture>
* <source srcset="leaflet-wide-dark.png" media="(prefers-color-scheme: dark)">
* <img src="leaflet-wide.png" alt="leaflet-wide">
* </picture>
* <picture>
* <source srcset="leaflet-narrow-dark.png" media="(prefers-color-scheme: dark)">
* <img src="leaflet-narrow.png" alt="leaflet-narrow">
* </picture>
*
* The `AdwLeaflet` widget can display its children like a [class`Gtk`.Box] does
* or like a [class`Gtk`.Stack] does, adapting to size changes by switching
* between the two modes.
*
* When there is enough space the children are displayed side by side, otherwise
* only one is displayed and the leaflet is said to be “folded”.
* The threshold is dictated by the preferred minimum sizes of the children.
* When a leaflet is folded, the children can be navigated using swipe gestures.
*
* The “over” and “under” transition types stack the children one on top of the
* other, while the “slide” transition puts the children side by side. While
* navigating to a child on the side or below can be performed by swiping the
* current child away, navigating to an upper child requires dragging it from
* the edge where it resides. This doesn't affect non-dragging swipes.
*
* ## CSS nodes
*
* `AdwLeaflet` has a single CSS node with name `leaflet`. The node will get the
* style classes `.folded` when it is folded, `.unfolded` when it's not, or none
* if it hasn't computed its fold yet.
*/
class Leaflet
extends Gtk.Widget
implements Swipeable, Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Orientable
{
static $gtype: GObject.GType<Leaflet>;
// Properties
/**
* Whether gestures and shortcuts for navigating backward are enabled.
*
* The supported gestures are:
*
* - One-finger swipe on touchscreens
* - Horizontal scrolling on touchpads (usually two-finger swipe)
* - Back/forward mouse buttons
*
* The keyboard back/forward keys are also supported, as well as the
* <kbd>Alt</kbd>+<kbd>←</kbd> shortcut for horizontal orientation, or
* <kbd>Alt</kbd>+<kbd>↑</kbd> for vertical orientation.
*
* If the orientation is horizontal, for right-to-left locales, gestures and
* shortcuts are reversed.
*
* Only children that have [property`LeafletPage:`navigatable] set to `TRUE`
* can be navigated to.
*/
get can_navigate_back(): boolean;
set can_navigate_back(val: boolean);
/**
* Whether gestures and shortcuts for navigating backward are enabled.
*
* The supported gestures are:
*
* - One-finger swipe on touchscreens
* - Horizontal scrolling on touchpads (usually two-finger swipe)
* - Back/forward mouse buttons
*
* The keyboard back/forward keys are also supported, as well as the
* <kbd>Alt</kbd>+<kbd>←</kbd> shortcut for horizontal orientation, or
* <kbd>Alt</kbd>+<kbd>↑</kbd> for vertical orientation.
*
* If the orientation is horizontal, for right-to-left locales, gestures and
* shortcuts are reversed.
*
* Only children that have [property`LeafletPage:`navigatable] set to `TRUE`
* can be navigated to.
*/
get canNavigateBack(): boolean;
set canNavigateBack(val: boolean);
/**
* Whether gestures and shortcuts for navigating forward are enabled.
*
* The supported gestures are:
*
* - One-finger swipe on touchscreens
* - Horizontal scrolling on touchpads (usually two-finger swipe)
* - Back/forward mouse buttons
*
* The keyboard back/forward keys are also supported, as well as the
* <kbd>Alt</kbd>+<kbd>→</kbd> shortcut for horizontal orientation, or
* <kbd>Alt</kbd>+<kbd>↓</kbd> for vertical orientation.
*
* If the orientation is horizontal, for right-to-left locales, gestures and
* shortcuts are reversed.
*
* Only children that have [property`LeafletPage:`navigatable] set to `TRUE`
* can be navigated to.
*/
get can_navigate_forward(): boolean;
set can_navigate_forward(val: boolean);
/**
* Whether gestures and shortcuts for navigating forward are enabled.
*
* The supported gestures are:
*
* - One-finger swipe on touchscreens
* - Horizontal scrolling on touchpads (usually two-finger swipe)
* - Back/forward mouse buttons
*
* The keyboard back/forward keys are also supported, as well as the
* <kbd>Alt</kbd>+<kbd>→</kbd> shortcut for horizontal orientation, or
* <kbd>Alt</kbd>+<kbd>↓</kbd> for vertical orientation.
*
* If the orientation is horizontal, for right-to-left locales, gestures and
* shortcuts are reversed.
*
* Only children that have [property`LeafletPage:`navigatable] set to `TRUE`
* can be navigated to.
*/
get canNavigateForward(): boolean;
set canNavigateForward(val: boolean);
/**
* Whether or not the leaflet can unfold.
*/
get can_unfold(): boolean;
set can_unfold(val: boolean);
/**
* Whether or not the leaflet can unfold.
*/
get canUnfold(): boolean;
set canUnfold(val: boolean);
/**
* The child transition spring parameters.
*
* The default value is equivalent to:
*
* ```c
* adw_spring_params_new (1, 0.5, 500)
* ```
*/
get child_transition_params(): SpringParams;
set child_transition_params(val: SpringParams);
/**
* The child transition spring parameters.
*
* The default value is equivalent to:
*
* ```c
* adw_spring_params_new (1, 0.5, 500)
* ```
*/
get childTransitionParams(): SpringParams;
set childTransitionParams(val: SpringParams);
/**
* Whether a child transition is currently running.
*/
get child_transition_running(): boolean;
/**
* Whether a child transition is currently running.
*/
get childTransitionRunning(): boolean;
/**
* Determines when the leaflet will fold.
*
* If set to `ADW_FOLD_THRESHOLD_POLICY_MINIMUM`, it will only fold when the
* children cannot fit anymore. With `ADW_FOLD_THRESHOLD_POLICY_NATURAL`, it
* will fold as soon as children don't get their natural size.
*
* This can be useful if you have a long ellipsizing label and want to let it
* ellipsize instead of immediately folding.
*/
get fold_threshold_policy(): FoldThresholdPolicy;
set fold_threshold_policy(val: FoldThresholdPolicy);
/**
* Determines when the leaflet will fold.
*
* If set to `ADW_FOLD_THRESHOLD_POLICY_MINIMUM`, it will only fold when the
* children cannot fit anymore. With `ADW_FOLD_THRESHOLD_POLICY_NATURAL`, it
* will fold as soon as children don't get their natural size.
*
* This can be useful if you have a long ellipsizing label and want to let it
* ellipsize instead of immediately folding.
*/
get foldThresholdPolicy(): FoldThresholdPolicy;
set foldThresholdPolicy(val: FoldThresholdPolicy);
/**
* Whether the leaflet is folded.
*
* The leaflet will be folded if the size allocated to it is smaller than the
* sum of the minimum or natural sizes of the children (see
* [property`Leaflet:`fold-threshold-policy]), it will be unfolded otherwise.
*/
get folded(): boolean;
/**
* Whether the leaflet allocates the same size for all children when folded.
*
* If set to `FALSE`, different children can have different size along the
* opposite orientation.
*/
get homogeneous(): boolean;
set homogeneous(val: boolean);
/**
* The mode transition animation duration, in milliseconds.
*/
get mode_transition_duration(): number;
set mode_transition_duration(val: number);
/**
* The mode transition animation duration, in milliseconds.
*/
get modeTransitionDuration(): number;
set modeTransitionDuration(val: number);
/**
* A selection model with the leaflet's pages.
*
* This can be used to keep an up-to-date view. The model also implements
* [iface`Gtk`.SelectionModel] and can be used to track and change the visible
* page.
*/
get pages(): Gtk.SelectionModel;
/**
* The type of animation used for transitions between modes and children.
*
* The transition type can be changed without problems at runtime, so it is
* possible to change the animation based on the mode or child that is about
* to become current.
*/
get transition_type(): LeafletTransitionType;
set transition_type(val: LeafletTransitionType);
/**
* The type of animation used for transitions between modes and children.
*
* The transition type can be changed without problems at runtime, so it is
* possible to change the animation based on the mode or child that is about
* to become current.
*/
get transitionType(): LeafletTransitionType;
set transitionType(val: LeafletTransitionType);
/**
* The widget currently visible when the leaflet is folded.
*
* The transition is determined by [property`Leaflet:`transition-type] and
* [property`Leaflet:`child-transition-params]. The transition can be cancelled
* by the user, in which case visible child will change back to the previously
* visible child.
*/
get visible_child(): Gtk.Widget;
set visible_child(val: Gtk.Widget);
/**
* The widget currently visible when the leaflet is folded.
*
* The transition is determined by [property`Leaflet:`transition-type] and
* [property`Leaflet:`child-transition-params]. The transition can be cancelled
* by the user, in which case visible child will change back to the previously
* visible child.
*/
get visibleChild(): Gtk.Widget;
set visibleChild(val: Gtk.Widget);
/**
* The name of the widget currently visible when the leaflet is folded.
*
* See [property`Leaflet:`visible-child].
*/
get visible_child_name(): string;
set visible_child_name(val: string);
/**
* The name of the widget currently visible when the leaflet is folded.
*
* See [property`Leaflet:`visible-child].
*/
get visibleChildName(): string;
set visibleChildName(val: string);
// Constructors
constructor(properties?: Partial<Leaflet.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): Leaflet;
// Methods
/**
* Adds a child to `self`.
* @param child the widget to add
* @returns the [class@LeafletPage] for @child
*/
append(child: Gtk.Widget): LeafletPage;
/**
* Finds the previous or next navigatable child.
*
* This will be the same child [method`Leaflet`.navigate] or swipe gestures will
* navigate to.
*
* If there's no child to navigate to, `NULL` will be returned instead.
*
* See [property`LeafletPage:`navigatable].
* @param direction the direction
* @returns the previous or next child
*/
get_adjacent_child(direction: NavigationDirection | null): Gtk.Widget | null;
/**
* Gets whether gestures and shortcuts for navigating backward are enabled.
* @returns Whether gestures and shortcuts are enabled.
*/
get_can_navigate_back(): boolean;
/**
* Gets whether gestures and shortcuts for navigating forward are enabled.
* @returns Whether gestures and shortcuts are enabled.
*/
get_can_navigate_forward(): boolean;
/**
* Gets whether `self` can unfold.
* @returns whether @self can unfold
*/
get_can_unfold(): boolean;
/**
* Finds the child of `self` with `name`.
*
* Returns `NULL` if there is no child with this name.
*
* See [property`LeafletPage:`name].
* @param name the name of the child to find
* @returns the requested child of @self
*/
get_child_by_name(name: string): Gtk.Widget | null;
/**
* Gets the child transition spring parameters for `self`.
* @returns the child transition parameters
*/
get_child_transition_params(): SpringParams;
/**
* Gets whether a child transition is currently running for `self`.
* @returns whether a transition is currently running
*/
get_child_transition_running(): boolean;
/**
* Gets the fold threshold policy for `self`.
* @returns the fold threshold policy
*/
get_fold_threshold_policy(): FoldThresholdPolicy;
/**
* Gets whether `self` is folded.
*
* The leaflet will be folded if the size allocated to it is smaller than the
* sum of the minimum or natural sizes of the children (see
* [property`Leaflet:`fold-threshold-policy]), it will be unfolded otherwise.
* @returns whether @self is folded.
*/
get_folded(): boolean;
/**
* Gets whether `self` is homogeneous.
* @returns whether @self is homogeneous
*/
get_homogeneous(): boolean;
/**
* Gets the mode transition animation duration for `self`.
* @returns the mode transition duration, in milliseconds.
*/
get_mode_transition_duration(): number;
/**
* Returns the [class`LeafletPage]` object for `child`.
* @param child a child of @self
* @returns the page object for @child
*/
get_page(child: Gtk.Widget): LeafletPage;
/**
* Returns a [iface`Gio`.ListModel] that contains the pages of the leaflet.
*
* This can be used to keep an up-to-date view. The model also implements
* [iface`Gtk`.SelectionModel] and can be used to track and change the visible
* page.
* @returns a `GtkSelectionModel` for the leaflet's children
*/
get_pages(): Gtk.SelectionModel;
/**
* Gets the type of animation used for transitions between modes and children.
* @returns the current transition type of @self
*/
get_transition_type(): LeafletTransitionType;
/**
* Gets the widget currently visible when the leaflet is folded.
* @returns the visible child
*/
get_visible_child(): Gtk.Widget | null;
/**
* Gets the name of the currently visible child widget.
* @returns the name of the visible child
*/
get_visible_child_name(): string | null;
/**
* Inserts `child` in the position after `sibling` in the list of children.
*
* If `sibling` is `NULL`, inserts `child` at the first position.
* @param child the widget to insert
* @param sibling the sibling after which to insert @child
* @returns the [class@LeafletPage] for @child
*/
insert_child_after(child: Gtk.Widget, sibling?: Gtk.Widget | null): LeafletPage;
/**
* Navigates to the previous or next child.
*
* The child must have the [property`LeafletPage:`navigatable] property set to
* `TRUE`, otherwise it will be skipped.
*
* This will be the same child as returned by
* [method`Leaflet`.get_adjacent_child] or navigated to via swipe gestures.
* @param direction the direction
* @returns whether the visible child was changed
*/
navigate(direction: NavigationDirection | null): boolean;
/**
* Inserts `child` at the first position in `self`.
* @param child the widget to prepend
* @returns the [class@LeafletPage] for @child
*/
prepend(child: Gtk.Widget): LeafletPage;
/**
* Removes a child widget from `self`.
* @param child the child to remove
*/
remove(child: Gtk.Widget): void;
/**
* Moves `child` to the position after `sibling` in the list of children.
*
* If `sibling` is `NULL`, moves `child` to the first position.
* @param child the widget to move, must be a child of @self
* @param sibling the sibling to move @child after
*/
reorder_child_after(child: Gtk.Widget, sibling?: Gtk.Widget | null): void;
/**
* Sets whether gestures and shortcuts for navigating backward are enabled.
*
* The supported gestures are:
*
* - One-finger swipe on touchscreens
* - Horizontal scrolling on touchpads (usually two-finger swipe)
* - Back/forward mouse buttons
*
* The keyboard back/forward keys are also supported, as well as the
* <kbd>Alt</kbd>+<kbd>←</kbd> shortcut for horizontal orientation, or
* <kbd>Alt</kbd>+<kbd>↑</kbd> for vertical orientation.
*
* If the orientation is horizontal, for right-to-left locales, gestures and
* shortcuts are reversed.
*
* Only children that have [property`LeafletPage:`navigatable] set to `TRUE` can
* be navigated to.
* @param can_navigate_back the new value
*/
set_can_navigate_back(can_navigate_back: boolean): void;
/**
* Sets whether gestures and shortcuts for navigating forward are enabled.
*
* The supported gestures are:
*
* - One-finger swipe on touchscreens
* - Horizontal scrolling on touchpads (usually two-finger swipe)
* - Back/forward mouse buttons
*
* The keyboard back/forward keys are also supported, as well as the
* <kbd>Alt</kbd>+<kbd>→</kbd> shortcut for horizontal orientation, or
* <kbd>Alt</kbd>+<kbd>↓</kbd> for vertical orientation.
*
* If the orientation is horizontal, for right-to-left locales, gestures and
* shortcuts are reversed.
*
* Only children that have [property`LeafletPage:`navigatable] set to `TRUE` can
* be navigated to.
* @param can_navigate_forward the new value
*/
set_can_navigate_forward(can_navigate_forward: boolean): void;
/**
* Sets whether `self` can unfold.
* @param can_unfold whether @self can unfold
*/
set_can_unfold(can_unfold: boolean): void;
/**
* Sets the child transition spring parameters for `self`.
*
* The default value is equivalent to:
*
* ```c
* adw_spring_params_new (1, 0.5, 500)
* ```
* @param params the new parameters
*/
set_child_transition_params(params: SpringParams): void;
/**
* Sets the fold threshold policy for `self`.
*
* If set to `ADW_FOLD_THRESHOLD_POLICY_MINIMUM`, it will only fold when the
* children cannot fit anymore. With `ADW_FOLD_THRESHOLD_POLICY_NATURAL`, it
* will fold as soon as children don't get their natural size.
*
* This can be useful if you have a long ellipsizing label and want to let it
* ellipsize instead of immediately folding.
* @param policy the policy to use
*/
set_fold_threshold_policy(policy: FoldThresholdPolicy | null): void;
/**
* Sets `self` to be homogeneous or not.
*
* If set to `FALSE`, different children can have different size along the
* opposite orientation.
* @param homogeneous whether to make @self homogeneous
*/
set_homogeneous(homogeneous: boolean): void;
/**
* Sets the mode transition animation duration for `self`.
* @param duration the new duration, in milliseconds
*/
set_mode_transition_duration(duration: number): void;
/**
* Sets the type of animation used for transitions between modes and children.
*
* The transition type can be changed without problems at runtime, so it is
* possible to change the animation based on the mode or child that is about to
* become current.
* @param transition the new transition type
*/
set_transition_type(transition: LeafletTransitionType | null): void;
/**
* Sets the widget currently visible when the leaflet is folded.
*
* The transition is determined by [property`Leaflet:`transition-type] and
* [property`Leaflet:`child-transition-params]. The transition can be cancelled
* by the user, in which case visible child will change back to the previously
* visible child.
* @param visible_child the new child
*/
set_visible_child(visible_child: Gtk.Widget): void;
/**
* Makes the child with the name `name` visible.
*
* See [property`Leaflet:`visible-child].
* @param name the name of a child
*/
set_visible_child_name(name: string): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* The orientation of the orientable.
*/
get orientation(): Gtk.Orientation;
set orientation(val: Gtk.Orientation);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// Inherited methods
/**
* Gets the progress `self` will snap back to after the gesture is canceled.
* @returns the cancel progress, unitless
*/
get_cancel_progress(): number;
/**
* Gets the swipe distance of `self`.
*
* This corresponds to how many pixels 1 unit represents.
* @returns the swipe distance in pixels
*/
get_distance(): number;
/**
* Gets the current progress of `self`.
* @returns the current progress, unitless
*/
get_progress(): number;
/**
* Gets the snap points of `self`.
*
* Each snap point represents a progress value that is considered acceptable to
* end the swipe on.
* @returns the snap points
*/
get_snap_points(): number[];
/**
* Gets the area `self` can start a swipe from for the given direction and
* gesture type.
*
* This can be used to restrict swipes to only be possible from a certain area,
* for example, to only allow edge swipes, or to have a draggable element and
* ignore swipes elsewhere.
*
* If not implemented, the default implementation returns the allocation of
* `self,` allowing swipes from anywhere.
* @param navigation_direction the direction of the swipe
* @param is_drag whether the swipe is caused by a dragging gesture
*/
get_swipe_area(navigation_direction: NavigationDirection | null, is_drag: boolean): Gdk.Rectangle;
/**
* Gets the progress `self` will snap back to after the gesture is canceled.
*/
vfunc_get_cancel_progress(): number;
/**
* Gets the swipe distance of `self`.
*
* This corresponds to how many pixels 1 unit represents.
*/
vfunc_get_distance(): number;
/**
* Gets the current progress of `self`.
*/
vfunc_get_progress(): number;
/**
* Gets the snap points of `self`.
*
* Each snap point represents a progress value that is considered acceptable to
* end the swipe on.
*/
vfunc_get_snap_points(): number[];
/**
* Gets the area `self` can start a swipe from for the given direction and
* gesture type.
*
* This can be used to restrict swipes to only be possible from a certain area,
* for example, to only allow edge swipes, or to have a draggable element and
* ignore swipes elsewhere.
*
* If not implemented, the default implementation returns the allocation of
* `self,` allowing swipes from anywhere.
* @param navigation_direction the direction of the swipe
* @param is_drag whether the swipe is caused by a dragging gesture
*/
vfunc_get_swipe_area(navigation_direction: NavigationDirection, is_drag: boolean): Gdk.Rectangle;
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: string): void;
/**
* Retrieves the orientation of the `orientable`.
* @returns the orientation of the @orientable
*/
get_orientation(): Gtk.Orientation;
/**
* Sets the orientation of the `orientable`.
* @param orientation the orientables new orientation
*/
set_orientation(orientation: Gtk.Orientation | null): void;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): 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 LeafletPage {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
child: Gtk.Widget;
name: string;
navigatable: boolean;
}
}
/**
* An auxiliary class used by [class`Leaflet]`.
*/
class LeafletPage extends GObject.Object {
static $gtype: GObject.GType<LeafletPage>;
// Properties
/**
* The leaflet child to which the page belongs.
*/
get child(): Gtk.Widget;
/**
* The name of the child page.
*/
get name(): string;
set name(val: string);
/**
* Whether the child can be navigated to when folded.
*
* If `FALSE`, the child will be ignored by
* [method`Leaflet`.get_adjacent_child], [method`Leaflet`.navigate], and swipe
* gestures.
*
* This can be used used to prevent switching to widgets like separators.
*/
get navigatable(): boolean;
set navigatable(val: boolean);
// Constructors
constructor(properties?: Partial<LeafletPage.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
// Methods
/**
* Gets the leaflet child to which `self` belongs.
* @returns the child to which @self belongs
*/
get_child(): Gtk.Widget;
/**
* Gets the name of `self`.
* @returns the name of @self.
*/
get_name(): string | null;
/**
* Gets whether the child can be navigated to when folded.
* @returns whether @self can be navigated to when folded
*/
get_navigatable(): boolean;
/**
* Sets the name of the `self`.
* @param name the new value to set
*/
set_name(name?: string | null): void;
/**
* Sets whether `self` can be navigated to when folded.
*
* If `FALSE`, the child will be ignored by [method`Leaflet`.get_adjacent_child],
* [method`Leaflet`.navigate], and swipe gestures.
*
* This can be used used to prevent switching to widgets like separators.
* @param navigatable whether @self can be navigated to when folded
*/
set_navigatable(navigatable: boolean): void;
}
namespace MessageDialog {
// Signal callback interfaces
interface Response {
(response: string): void;
}
// Constructor properties interface
interface ConstructorProps
extends Gtk.Window.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Native.ConstructorProps,
Gtk.Root.ConstructorProps,
Gtk.ShortcutManager.ConstructorProps {
body: string;
body_use_markup: boolean;
bodyUseMarkup: boolean;
close_response: string;
closeResponse: string;
default_response: string;
defaultResponse: string;
extra_child: Gtk.Widget;
extraChild: Gtk.Widget;
heading: string;
heading_use_markup: boolean;
headingUseMarkup: boolean;
}
}
/**
* A dialog presenting a message or a question.
*
* <picture>
* <source srcset="message-dialog-dark.png" media="(prefers-color-scheme: dark)">
* <img src="message-dialog.png" alt="message-dialog">
* </picture>
*
* Message dialogs have a heading, a body, an optional child widget, and one or
* multiple responses, each presented as a button.
*
* Each response has a unique string ID, and a button label. Additionally, each
* response can be enabled or disabled, and can have a suggested or destructive
* appearance.
*
* When one of the responses is activated, or the dialog is closed, the
* [signal`MessageDialog:`:response] signal will be emitted. This signal is
* detailed, and the detail, as well as the `response` parameter will be set to
* the ID of the activated response, or to the value of the
* [property`MessageDialog:`close-response] property if the dialog had been
* closed without activating any of the responses.
*
* Response buttons can be presented horizontally or vertically depending on
* available space.
*
* When a response is activated, `AdwMessageDialog` is closed automatically.
*
* An example of using a message dialog:
*
* ```c
* GtkWidget *dialog;
*
* dialog = adw_message_dialog_new (parent, _("Replace File?"), NULL);
*
* adw_message_dialog_format_body (ADW_MESSAGE_DIALOG (dialog),
* _("A file named “%s” already exists. Do you want to replace it?"),
* filename);
*
* adw_message_dialog_add_responses (ADW_MESSAGE_DIALOG (dialog),
* "cancel", _("_Cancel"),
* "replace", _("_Replace"),
* NULL);
*
* adw_message_dialog_set_response_appearance (ADW_MESSAGE_DIALOG (dialog), "replace", ADW_RESPONSE_DESTRUCTIVE);
*
* adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG (dialog), "cancel");
* adw_message_dialog_set_close_response (ADW_MESSAGE_DIALOG (dialog), "cancel");
*
* g_signal_connect (dialog, "response", G_CALLBACK (response_cb), self);
*
* gtk_window_present (GTK_WINDOW (dialog));
* ```
*
* ## Async API
*
* `AdwMessageDialog` can also be used via the [method`MessageDialog`.choose]
* method. This API follows the GIO async pattern, for example:
*
* ```c
* static void
* dialog_cb (AdwMessageDialog *dialog,
* GAsyncResult *result,
* MyWindow *self)
* {
* const char *response = adw_message_dialog_choose_finish (dialog, result);
*
* // ...
* }
*
* static void
* show_dialog (MyWindow *self)
* {
* GtkWidget *dialog;
*
* dialog = adw_message_dialog_new (GTK_WINDOW (self), _("Replace File?"), NULL);
*
* adw_message_dialog_format_body (ADW_MESSAGE_DIALOG (dialog),
* _("A file named “%s” already exists. Do you want to replace it?"),
* filename);
*
* adw_message_dialog_add_responses (ADW_MESSAGE_DIALOG (dialog),
* "cancel", _("_Cancel"),
* "replace", _("_Replace"),
* NULL);
*
* adw_message_dialog_set_response_appearance (ADW_MESSAGE_DIALOG (dialog), "replace", ADW_RESPONSE_DESTRUCTIVE);
*
* adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG (dialog), "cancel");
* adw_message_dialog_set_close_response (ADW_MESSAGE_DIALOG (dialog), "cancel");
*
* adw_message_dialog_choose (ADW_MESSAGE_DIALOG (dialog), NULL, (GAsyncReadyCallback) dialog_cb, self);
* }
* ```
*
* ## AdwMessageDialog as GtkBuildable
*
* `AdwMessageDialog` supports adding responses in UI definitions by via the
* `<responses>` element that may contain multiple `<response>` elements, each
* representing a response.
*
* Each of the `<response>` elements must have the `id` attribute specifying the
* response ID. The contents of the element are used as the response label.
*
* Response labels can be translated with the usual `translatable`, `context`
* and `comments` attributes.
*
* The `<response>` elements can also have `enabled` and/or `appearance`
* attributes. See [method`MessageDialog`.set_response_enabled] and
* [method`MessageDialog`.set_response_appearance] for details.
*
* Example of an `AdwMessageDialog` UI definition:
*
* ```xml
* <object class="AdwMessageDialog" id="dialog">
* <property name="heading" translatable="yes">Save Changes?</property>
* <property name="body" translatable="yes">Open documents contain unsaved changes. Changes which are not saved will be permanently lost.</property>
* <property name="default-response">save</property>
* <property name="close-response">cancel</property>
* <signal name="response" handler="response_cb"/>
* <responses>
* <response id="cancel" translatable="yes">_Cancel</response>
* <response id="discard" translatable="yes" appearance="destructive">_Discard</response>
* <response id="save" translatable="yes" appearance="suggested" enabled="false">_Save</response>
* </responses>
* </object>
* ```
*
* ## Accessibility
*
* `AdwMessageDialog` uses the `GTK_ACCESSIBLE_ROLE_DIALOG` role.
*/
class MessageDialog
extends Gtk.Window
implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Native, Gtk.Root, Gtk.ShortcutManager
{
static $gtype: GObject.GType<MessageDialog>;
// Properties
/**
* The body text of the dialog.
*/
get body(): string;
set body(val: string);
/**
* Whether the body text includes Pango markup.
*
* See [func`Pango`.parse_markup].
*/
get body_use_markup(): boolean;
set body_use_markup(val: boolean);
/**
* Whether the body text includes Pango markup.
*
* See [func`Pango`.parse_markup].
*/
get bodyUseMarkup(): boolean;
set bodyUseMarkup(val: boolean);
/**
* The ID of the close response.
*
* It will be passed to [signal`MessageDialog:`:response] if the window is
* closed by pressing <kbd>Escape</kbd> or with a system action.
*
* It doesn't have to correspond to any of the responses in the dialog.
*
* The default close response is `close`.
*/
get close_response(): string;
set close_response(val: string);
/**
* The ID of the close response.
*
* It will be passed to [signal`MessageDialog:`:response] if the window is
* closed by pressing <kbd>Escape</kbd> or with a system action.
*
* It doesn't have to correspond to any of the responses in the dialog.
*
* The default close response is `close`.
*/
get closeResponse(): string;
set closeResponse(val: string);
/**
* The response ID of the default response.
*
* If set, pressing <kbd>Enter</kbd> will activate the corresponding button.
*
* If set to `NULL` or a non-existent response ID, pressing <kbd>Enter</kbd>
* will do nothing.
*/
get default_response(): string;
set default_response(val: string);
/**
* The response ID of the default response.
*
* If set, pressing <kbd>Enter</kbd> will activate the corresponding button.
*
* If set to `NULL` or a non-existent response ID, pressing <kbd>Enter</kbd>
* will do nothing.
*/
get defaultResponse(): string;
set defaultResponse(val: string);
/**
* The child widget.
*
* Displayed below the heading and body.
*/
get extra_child(): Gtk.Widget;
set extra_child(val: Gtk.Widget);
/**
* The child widget.
*
* Displayed below the heading and body.
*/
get extraChild(): Gtk.Widget;
set extraChild(val: Gtk.Widget);
/**
* The heading of the dialog.
*/
get heading(): string;
set heading(val: string);
/**
* Whether the heading includes Pango markup.
*
* See [func`Pango`.parse_markup].
*/
get heading_use_markup(): boolean;
set heading_use_markup(val: boolean);
/**
* Whether the heading includes Pango markup.
*
* See [func`Pango`.parse_markup].
*/
get headingUseMarkup(): boolean;
set headingUseMarkup(val: boolean);
// Constructors
constructor(properties?: Partial<MessageDialog.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](parent?: Gtk.Window | null, heading?: string | null, body?: string | null): MessageDialog;
// Conflicted with Gtk.Window.new
static ['new'](...args: never[]): any;
// 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: 'response', callback: (_source: this, response: string) => void): number;
connect_after(signal: 'response', callback: (_source: this, response: string) => void): number;
emit(signal: 'response', response: string): void;
// Virtual methods
/**
* Emits the [signal`MessageDialog:`:response] signal with the given response ID.
*
* Used to indicate that the user has responded to the dialog in some way.
* @param response response ID
*/
vfunc_response(response: string): void;
// Methods
/**
* Adds a response with `id` and `label` to `self`.
*
* Responses are represented as buttons in the dialog.
*
* Response ID must be unique. It will be used in
* [signal`MessageDialog:`:response] to tell which response had been activated,
* as well as to inspect and modify the response later.
*
* An embedded underline in `label` indicates a mnemonic.
*
* [method`MessageDialog`.set_response_label] can be used to change the response
* label after it had been added.
*
* [method`MessageDialog`.set_response_enabled] and
* [method`MessageDialog`.set_response_appearance] can be used to customize the
* responses further.
* @param id the response ID
* @param label the response label
*/
add_response(id: string, label: string): void;
/**
* This function shows `self` to the user.
* @param cancellable a `GCancellable` to cancel the operation
*/
choose(cancellable?: Gio.Cancellable | null): Promise<string>;
/**
* This function shows `self` to the user.
* @param cancellable a `GCancellable` to cancel the operation
* @param callback a callback to call when the operation is complete
*/
choose(cancellable: Gio.Cancellable | null, callback: Gio.AsyncReadyCallback<this> | null): void;
/**
* This function shows `self` to the user.
* @param cancellable a `GCancellable` to cancel the operation
* @param callback a callback to call when the operation is complete
*/
choose(
cancellable?: Gio.Cancellable | null,
callback?: Gio.AsyncReadyCallback<this> | null,
): Promise<string> | void;
/**
* Finishes the [method`MessageDialog`.choose] call and returns the response ID.
* @param result a `GAsyncResult`
* @returns the ID of the response that was selected, or [property@MessageDialog:close-response] if the call was cancelled.
*/
choose_finish(result: Gio.AsyncResult): string;
/**
* Gets the body text of `self`.
* @returns the body of @self.
*/
get_body(): string;
/**
* Gets whether the body text of `self` includes Pango markup.
* @returns whether @self uses markup for body text
*/
get_body_use_markup(): boolean;
/**
* Gets the ID of the close response of `self`.
* @returns the close response ID
*/
get_close_response(): string;
/**
* Gets the ID of the default response of `self`.
* @returns the default response ID
*/
get_default_response(): string | null;
/**
* Gets the child widget of `self`.
* @returns the child widget of @self.
*/
get_extra_child(): Gtk.Widget | null;
/**
* Gets the heading of `self`.
* @returns the heading of @self.
*/
get_heading(): string | null;
/**
* Gets whether the heading of `self` includes Pango markup.
* @returns whether @self uses markup for heading
*/
get_heading_use_markup(): boolean;
/**
* Gets the appearance of `response`.
*
* See [method`MessageDialog`.set_response_appearance].
* @param response a response ID
* @returns the appearance of @response
*/
get_response_appearance(response: string): ResponseAppearance;
/**
* Gets whether `response` is enabled.
*
* See [method`MessageDialog`.set_response_enabled].
* @param response a response ID
* @returns whether @response is enabled
*/
get_response_enabled(response: string): boolean;
/**
* Gets the label of `response`.
*
* See [method`MessageDialog`.set_response_label].
* @param response a response ID
* @returns the label of @response
*/
get_response_label(response: string): string;
/**
* Gets whether `self` has a response with the ID `response`.
* @param response response ID
* @returns whether @self has a response with the ID @response.
*/
has_response(response: string): boolean;
/**
* Removes a response from `self`.
* @param id the response ID
*/
remove_response(id: string): void;
/**
* Emits the [signal`MessageDialog:`:response] signal with the given response ID.
*
* Used to indicate that the user has responded to the dialog in some way.
* @param response response ID
*/
response(response: string): void;
/**
* Sets the body text of `self`.
* @param body the body of @self
*/
set_body(body: string): void;
/**
* Sets whether the body text of `self` includes Pango markup.
*
* See [func`Pango`.parse_markup].
* @param use_markup whether to use markup for body text
*/
set_body_use_markup(use_markup: boolean): void;
/**
* Sets the ID of the close response of `self`.
*
* It will be passed to [signal`MessageDialog:`:response] if the window is
* closed by pressing <kbd>Escape</kbd> or with a system action.
*
* It doesn't have to correspond to any of the responses in the dialog.
*
* The default close response is `close`.
* @param response the close response ID
*/
set_close_response(response: string): void;
/**
* Sets the ID of the default response of `self`.
*
* If set, pressing <kbd>Enter</kbd> will activate the corresponding button.
*
* If set to `NULL` or to a non-existent response ID, pressing <kbd>Enter</kbd>
* will do nothing.
* @param response the default response ID
*/
set_default_response(response?: string | null): void;
/**
* Sets the child widget of `self`.
*
* The child widget is displayed below the heading and body.
* @param child the child widget
*/
set_extra_child(child?: Gtk.Widget | null): void;
/**
* Sets the heading of `self`.
* @param heading the heading of @self
*/
set_heading(heading?: string | null): void;
/**
* Sets whether the heading of `self` includes Pango markup.
*
* See [func`Pango`.parse_markup].
* @param use_markup whether to use markup for heading
*/
set_heading_use_markup(use_markup: boolean): void;
/**
* Sets the appearance for `response`.
*
* <picture>
* <source srcset="message-dialog-appearance-dark.png" media="(prefers-color-scheme: dark)">
* <img src="message-dialog-appearance.png" alt="message-dialog-appearance">
* </picture>
*
* Use `ADW_RESPONSE_SUGGESTED` to mark important responses such as the
* affirmative action, like the Save button in the example.
*
* Use `ADW_RESPONSE_DESTRUCTIVE` to draw attention to the potentially damaging
* consequences of using `response`. This appearance acts as a warning to the
* user. The Discard button in the example is using this appearance.
*
* The default appearance is `ADW_RESPONSE_DEFAULT`.
*
* Negative responses like Cancel or Close should use the default appearance.
* @param response a response ID
* @param appearance appearance for @response
*/
set_response_appearance(response: string, appearance: ResponseAppearance | null): void;
/**
* Sets whether `response` is enabled.
*
* If `response` is not enabled, the corresponding button will have
* [property`Gtk`.Widget:sensitive] set to `FALSE` and it can't be activated as
* a default response.
*
* `response` can still be used as [property`MessageDialog:`close-response] while
* it's not enabled.
*
* Responses are enabled by default.
* @param response a response ID
* @param enabled whether to enable @response
*/
set_response_enabled(response: string, enabled: boolean): void;
/**
* Sets the label of `response` to `label`.
*
* Labels are displayed on the dialog buttons. An embedded underline in `label`
* indicates a mnemonic.
* @param response a response ID
* @param label the label of @response
*/
set_response_label(response: string, label: string): void;
// Inherited properties
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// Inherited methods
/**
* Returns the renderer that is used for this `GtkNative`.
* @returns the renderer for @self
*/
get_renderer(): Gsk.Renderer | null;
/**
* Returns the surface of this `GtkNative`.
* @returns the surface of @self
*/
get_surface(): Gdk.Surface | null;
/**
* Retrieves the surface transform of `self`.
*
* This is the translation from `self'`s surface coordinates into
* `self'`s widget coordinates.
*/
get_surface_transform(): [number, number];
/**
* Realizes a `GtkNative`.
*
* This should only be used by subclasses.
*/
realize(): void;
/**
* Unrealizes a `GtkNative`.
*
* This should only be used by subclasses.
*/
unrealize(): void;
/**
* Returns the display that this `GtkRoot` is on.
* @returns the display of @root
*/
get_display(): Gdk.Display;
/**
* Retrieves the current focused widget within the root.
*
* Note that this is the widget that would have the focus
* if the root is active; if the root is not focused then
* `gtk_widget_has_focus (widget)` will be %FALSE for the
* widget.
* @returns the currently focused widget
*/
get_focus(): Gtk.Widget | null;
/**
* If `focus` is not the current focus widget, and is focusable, sets
* it as the focus widget for the root.
*
* If `focus` is %NULL, unsets the focus widget for the root.
*
* To set the focus to a particular widget in the root, it is usually
* more convenient to use [method`Gtk`.Widget.grab_focus] instead of
* this function.
* @param focus widget to be the new focus widget, or %NULL to unset the focus widget
*/
set_focus(focus?: Gtk.Widget | null): void;
/**
* Add a `GtkShortcutController` to be managed.
* @param controller
*/
vfunc_add_controller(controller: Gtk.ShortcutController): void;
/**
* Remove a `GtkShortcutController` that had previously
* been added
* @param controller
*/
vfunc_remove_controller(controller: Gtk.ShortcutController): 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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace MultiLayoutView {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
layout: Layout;
layout_name: string;
layoutName: string;
}
}
/**
* A widget for switching between different layouts.
*
* `AdwMultiLayoutView` contains layouts and children. Each child has
* an ID, each layout has slots inside it, each slot also has an ID. When
* switching layouts, children are inserted into slots with matching IDs. The
* [property`Gtk`.Widget:visible] property of each slot is updated to match
* that of the inserted child.
*
* This can be useful for rearranging children when it's difficult to do so
* otherwise, for example to move a child from a sidebar to a bottom bar.
*
* The currently used layout can be switched using the
* [property`MultiLayoutView:`layout] or [property`MultiLayoutView:`layout-name]
* properties. For example, it can be done via a [class`Adw`.Breakpoint] setter
* to change layouts depending on the window size.
*
* ## AdwMultiLayoutView as GtkBuildable
*
* The `AdwMultiLayoutView` implementation of the [iface`Gtk`.Buildable]
* interface supports adding layouts via `<child>` element with the `type`
* attribute omitted.
*
* It also supports setting children via `<child type="ID">`.
*
* Example of an `AdwMultiLayoutView` UI definition that can display a secondary
* child as either a sidebar or a bottom sheet.
*
* ```xml
* <object class="AdwMultiLayoutView">
* <child>
* <object class="AdwLayout">
* <property name="name">sidebar</property>
* <property name="content">
* <object class="AdwOverlaySplitView">
* <property name="sidebar">
* <object class="AdwLayoutSlot">
* <property name="id">secondary</property>
* </object>
* </property>
* <property name="content">
* <object class="AdwLayoutSlot">
* <property name="id">primary</property>
* </object>
* </property>
* </object>
* </property>
* </object>
* </child>
* <child>
* <object class="AdwLayout">
* <property name="name">bottom-sheet</property>
* <property name="content">
* <object class="AdwBottomSheet">
* <property name="open">True</property>
* <property name="content">
* <object class="AdwLayoutSlot">
* <property name="id">primary</property>
* </object>
* </property>
* <property name="sheet">
* <object class="AdwLayoutSlot">
* <property name="id">secondary</property>
* </object>
* </property>
* </object>
* </property>
* </object>
* </child>
* <child type="primary">
* <!-- ... -->
* </child>
* <child type="secondary">
* <!-- ... -->
* </child>
* </object>
* ```
*
* ## CSS nodes
*
* `AdwMultiLayoutView` has a single CSS node with name `multi-layout-view`.
*/
class MultiLayoutView extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<MultiLayoutView>;
// Properties
/**
* The currently used layout.
*/
get layout(): Layout;
set layout(val: Layout);
/**
* The name of the currently used layout.
*
* See [property`Layout:`name].
*/
get layout_name(): string;
set layout_name(val: string);
/**
* The name of the currently used layout.
*
* See [property`Layout:`name].
*/
get layoutName(): string;
set layoutName(val: string);
// Constructors
constructor(properties?: Partial<MultiLayoutView.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): MultiLayoutView;
// Methods
/**
* Adds `layout` to `self`.
* @param layout the layout to add
*/
add_layout(layout: Layout): void;
/**
* Gets the child for `id` to `self`.
* @param id the id of the child
* @returns the child for @id
*/
get_child(id: string): Gtk.Widget | null;
/**
* Gets the currently used layout of `self`.
* @returns the current layout
*/
get_layout(): Layout | null;
/**
* Gets layout with the name `name` from `self,` or `NULL` if it doesn't exist.
*
* See [property`Layout:`name].
* @param name the name of the layout
* @returns the layout with @name
*/
get_layout_by_name(name: string): Layout | null;
/**
* Returns the name of the currently used layout of `self`.
* @returns the name of the current layout
*/
get_layout_name(): string | null;
/**
* Removes `layout` from `self`.
* @param layout the layout to add
*/
remove_layout(layout: Layout): void;
/**
* Sets `child` as the child for `id` in `self`.
*
* When changing layouts, it will be inserted into the slot with `id`.
* @param id the id of the child
* @param child the child to set
*/
set_child(id: string, child: Gtk.Widget): void;
/**
* Makes `layout` the current layout of `self`.
* @param layout a layout in @self
*/
set_layout(layout: Layout): void;
/**
* Makes the layout with `name` the current layout of `self`.
*
* See [property`Layout:`name].
* @param name the name of the layout
*/
set_layout_name(name: string): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 NavigationPage {
// Signal callback interfaces
interface Hidden {
(): void;
}
interface Hiding {
(): void;
}
interface Showing {
(): void;
}
interface Shown {
(): void;
}
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
can_pop: boolean;
canPop: boolean;
child: Gtk.Widget;
tag: string;
title: string;
}
}
/**
* A page within [class`NavigationView]` or [class`NavigationSplitView]`.
*
* Each page has a child widget, a title and optionally a tag.
*
* The [signal`NavigationPage:`:showing], [signal`NavigationPage:`:shown],
* [signal`NavigationPage:`:hiding] and [signal`NavigationPage:`:hidden] signals
* can be used to track the page's visibility within its `AdwNavigationView`.
*
* ## Header Bar Integration
*
* When placed inside `AdwNavigationPage`, [class`HeaderBar]` will display the
* page title instead of window title.
*
* When used together with [class`NavigationView]`, it will also display a back
* button that can be used to go back to the previous page. Set
* [property`HeaderBar:`show-back-button] to `FALSE` to disable that behavior if
* it's unwanted.
*
* ## CSS Nodes
*
* `AdwNavigationPage` has a single CSS node with name
* `navigation-view-page`.
*
* ## Accessibility
*
* `AdwNavigationPage` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.
*/
class NavigationPage extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<NavigationPage>;
// Properties
/**
* Whether the page can be popped from navigation stack.
*
* Set it to `FALSE` to disable shortcuts and gestures, as well as remove the
* back button from [class`HeaderBar]`.
*
* Manually calling [method`NavigationView`.pop] or using the `navigation.pop`
* action will still work.
*
* See [property`HeaderBar:`show-back-button] for removing only the back
* button, but not shortcuts.
*/
get can_pop(): boolean;
set can_pop(val: boolean);
/**
* Whether the page can be popped from navigation stack.
*
* Set it to `FALSE` to disable shortcuts and gestures, as well as remove the
* back button from [class`HeaderBar]`.
*
* Manually calling [method`NavigationView`.pop] or using the `navigation.pop`
* action will still work.
*
* See [property`HeaderBar:`show-back-button] for removing only the back
* button, but not shortcuts.
*/
get canPop(): boolean;
set canPop(val: boolean);
/**
* The child widget.
*/
get child(): Gtk.Widget;
set child(val: Gtk.Widget);
/**
* The page tag.
*
* The tag can be used to retrieve the page with
* [method`NavigationView`.find_page], as well as with
* [method`NavigationView`.push_by_tag], [method`NavigationView`.pop_to_tag] or
* [method`NavigationView`.replace_with_tags].
*
* Tags must be unique within each [class`NavigationView]`.
*
* The tag also must be set to use the `navigation.push` action.
*/
get tag(): string;
set tag(val: string);
/**
* The page title.
*
* It's displayed in [class`HeaderBar]` instead of the window title, and used
* as the tooltip on the next page's back button, as well as by screen reader.
*/
get title(): string;
set title(val: string);
// Constructors
constructor(properties?: Partial<NavigationPage.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](child: Gtk.Widget, title: string): NavigationPage;
static new_with_tag(child: Gtk.Widget, title: string, tag: string): NavigationPage;
// 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: 'hidden', callback: (_source: this) => void): number;
connect_after(signal: 'hidden', callback: (_source: this) => void): number;
emit(signal: 'hidden'): void;
connect(signal: 'hiding', callback: (_source: this) => void): number;
connect_after(signal: 'hiding', callback: (_source: this) => void): number;
emit(signal: 'hiding'): void;
connect(signal: 'showing', callback: (_source: this) => void): number;
connect_after(signal: 'showing', callback: (_source: this) => void): number;
emit(signal: 'showing'): void;
connect(signal: 'shown', callback: (_source: this) => void): number;
connect_after(signal: 'shown', callback: (_source: this) => void): number;
emit(signal: 'shown'): void;
// Virtual methods
/**
* Called when the navigation view transition has been completed and the page
* is fully hidden.
*/
vfunc_hidden(): void;
/**
* Called when the page starts hiding at the beginning of the navigation view
* transition.
*/
vfunc_hiding(): void;
/**
* Called when the page shows at the beginning of the navigation view
* transition.
*/
vfunc_showing(): void;
/**
* Called when the navigation view transition has been completed and the page
* is fully shown.
*/
vfunc_shown(): void;
// Methods
/**
* Gets whether `self` can be popped from navigation stack.
* @returns whether the page can be popped from navigation stack
*/
get_can_pop(): boolean;
/**
* Gets the child widget of `self`.
* @returns the child widget of @self
*/
get_child(): Gtk.Widget | null;
/**
* Gets the tag of `self`.
* @returns the page tag
*/
get_tag(): string | null;
/**
* Gets the title of `self`.
* @returns the title of @self
*/
get_title(): string;
/**
* Sets whether `self` can be popped from navigation stack.
*
* Set it to `FALSE` to disable shortcuts and gestures, as well as remove the
* back button from [class`HeaderBar]`.
*
* Manually calling [method`NavigationView`.pop] or using the `navigation.pop`
* action will still work.
*
* See [property`HeaderBar:`show-back-button] for removing only the back button,
* but not shortcuts.
* @param can_pop whether the page can be popped from navigation stack
*/
set_can_pop(can_pop: boolean): void;
/**
* Sets the child widget of `self`.
* @param child the child widget
*/
set_child(child?: Gtk.Widget | null): void;
/**
* Sets the tag for `self`.
*
* The tag can be used to retrieve the page with
* [method`NavigationView`.find_page], as well as with
* [method`NavigationView`.push_by_tag], [method`NavigationView`.pop_to_tag] or
* [method`NavigationView`.replace_with_tags].
*
* Tags must be unique within each [class`NavigationView]`.
*
* The tag also must be set to use the `navigation.push` action.
* @param tag the page tag
*/
set_tag(tag?: string | null): void;
/**
* Sets the title of `self`.
*
* It's displayed in [class`HeaderBar]` instead of the window title, and used as
* the tooltip on the next page's back button, as well as by screen reader.
* @param title the title
*/
set_title(title: string): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 NavigationSplitView {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
collapsed: boolean;
content: NavigationPage;
max_sidebar_width: number;
maxSidebarWidth: number;
min_sidebar_width: number;
minSidebarWidth: number;
show_content: boolean;
showContent: boolean;
sidebar: NavigationPage;
sidebar_position: Gtk.PackType;
sidebarPosition: Gtk.PackType;
sidebar_width_fraction: number;
sidebarWidthFraction: number;
sidebar_width_unit: LengthUnit;
sidebarWidthUnit: LengthUnit;
}
}
/**
* A widget presenting sidebar and content side by side or as a navigation view.
*
* <picture>
* <source srcset="navigation-split-view-dark.png" media="(prefers-color-scheme: dark)">
* <img src="navigation-split-view.png" alt="navigation-split-view">
* </picture>
* <picture>
* <source srcset="navigation-split-view-collapsed-dark.png" media="(prefers-color-scheme: dark)">
* <img src="navigation-split-view-collapsed.png" alt="navigation-split-view-collapsed">
* </picture>
*
* `AdwNavigationSplitView` has two [class`NavigationPage]` children: sidebar and
* content, and displays them side by side.
*
* When [property`NavigationSplitView:`collapsed] is set to `TRUE`, it instead
* puts both children inside an [class`NavigationView]`. The
* [property`NavigationSplitView:`show-content] controls which child is visible
* while collapsed.
*
* See also [class`OverlaySplitView]`.
*
* `AdwNavigationSplitView` is typically used together with an [class`Breakpoint]`
* setting the `collapsed` property to `TRUE` on small widths, as follows:
*
* ```xml
* <object class="AdwWindow">
* <property name="width-request">280</property>
* <property name="height-request">200</property>
* <property name="default-width">800</property>
* <property name="default-height">800</property>
* <child>
* <object class="AdwBreakpoint">
* <condition>max-width: 400sp</condition>
* <setter object="split_view" property="collapsed">True</setter>
* </object>
* </child>
* <property name="content">
* <object class="AdwNavigationSplitView" id="split_view">
* <property name="sidebar">
* <object class="AdwNavigationPage">
* <property name="title" translatable="yes">Sidebar</property>
* <property name="child">
* <!-- ... -->
* </property>
* </object>
* </property>
* <property name="content">
* <object class="AdwNavigationPage">
* <property name="title" translatable="yes">Content</property>
* <property name="child">
* <!-- ... -->
* </property>
* </object>
* </property>
* </object>
* </property>
* </object>
* ```
*
* ## Sizing
*
* When not collapsed, `AdwNavigationSplitView` changes the sidebar width
* depending on its own width.
*
* If possible, it tries to allocate a fraction of the total width, controlled
* with the [property`NavigationSplitView:`sidebar-width-fraction] property.
*
* The sidebar also has minimum and maximum sizes, controlled with the
* [property`NavigationSplitView:`min-sidebar-width] and
* [property`NavigationSplitView:`max-sidebar-width] properties.
*
* The minimum and maximum sizes are using the length unit specified with the
* [property`NavigationSplitView:`sidebar-width-unit].
*
* By default, sidebar is using 25% of the total width, with 180sp as the
* minimum size and 280sp as the maximum size.
*
* ## Header Bar Integration
*
* When used inside `AdwNavigationSplitView`, [class`HeaderBar]` will
* automatically hide the window buttons in the middle.
*
* When collapsed, it also displays a back button for the content widget, as
* well as the page titles. See [class`NavigationView]` documentation for details.
*
* ## Actions
*
* `AdwNavigationSplitView` defines the same actions as `AdwNavigationView`, but
* they can be used even when the split view is not collapsed:
*
* - `navigation.push` takes a string parameter specifying the tag of the page
* to push. If it matches the tag of the content widget, it sets
* [property`NavigationSplitView:`show-content] to `TRUE`.
*
* - `navigation.pop` doesn't take any parameters and sets
* [property`NavigationSplitView:`show-content] to `FALSE`.
*
* ## `AdwNavigationSplitView` as `GtkBuildable`
*
* The `AdwNavigationSplitView` implementation of the [iface`Gtk`.Buildable]
* interface supports setting the sidebar widget by specifying “sidebar” as the
* “type” attribute of a `<child>` element, Specifying “content” child type or
* omitting it results in setting the content widget.
*
* ## CSS nodes
*
* `AdwNavigationSplitView` has a single CSS node with the name
* `navigation-split-view`.
*
* When collapsed, it contains a child node with the name `navigation-view`
* containing both children.
*
* ```
* navigation-split-view
* ╰── navigation-view
* ├── [sidebar child]
* ╰── [content child]
* ```
*
* When not collapsed, it contains two nodes with the name `widget`, one with
* the `.sidebar-pane` style class, the other one with `.content-view` style
* class, containing the sidebar and content children respectively.
*
* ```
* navigation-split-view
* ├── widget.sidebar-pane
* │ ╰── [sidebar child]
* ╰── widget.content-pane
* ╰── [content child]
* ```
*
* ## Accessibility
*
* `AdwNavigationSplitView` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.
*/
class NavigationSplitView extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<NavigationSplitView>;
// Properties
/**
* Whether the split view is collapsed.
*
* When collapsed, the children are put inside an [class`NavigationView]`,
* otherwise they are displayed side by side.
*
* The [property`NavigationSplitView:`show-content] controls which child is
* visible while collapsed.
*/
get collapsed(): boolean;
set collapsed(val: boolean);
/**
* The content widget.
*/
get content(): NavigationPage;
set content(val: NavigationPage);
/**
* The maximum sidebar width.
*
* Maximum width is affected by
* [property`NavigationSplitView:`sidebar-width-unit].
*
* The sidebar widget can still be allocated with larger width if its own
* minimum width exceeds it.
*/
get max_sidebar_width(): number;
set max_sidebar_width(val: number);
/**
* The maximum sidebar width.
*
* Maximum width is affected by
* [property`NavigationSplitView:`sidebar-width-unit].
*
* The sidebar widget can still be allocated with larger width if its own
* minimum width exceeds it.
*/
get maxSidebarWidth(): number;
set maxSidebarWidth(val: number);
/**
* The minimum sidebar width.
*
* Minimum width is affected by
* [property`NavigationSplitView:`sidebar-width-unit].
*
* The sidebar widget can still be allocated with larger width if its own
* minimum width exceeds it.
*/
get min_sidebar_width(): number;
set min_sidebar_width(val: number);
/**
* The minimum sidebar width.
*
* Minimum width is affected by
* [property`NavigationSplitView:`sidebar-width-unit].
*
* The sidebar widget can still be allocated with larger width if its own
* minimum width exceeds it.
*/
get minSidebarWidth(): number;
set minSidebarWidth(val: number);
/**
* Determines the visible page when collapsed.
*
* If set to `TRUE`, the content widget will be the visible page when
* [property`NavigationSplitView:`collapsed] is `TRUE`; otherwise the sidebar
* widget will be visible.
*
* If the split view is already collapsed, the visible page changes
* immediately.
*/
get show_content(): boolean;
set show_content(val: boolean);
/**
* Determines the visible page when collapsed.
*
* If set to `TRUE`, the content widget will be the visible page when
* [property`NavigationSplitView:`collapsed] is `TRUE`; otherwise the sidebar
* widget will be visible.
*
* If the split view is already collapsed, the visible page changes
* immediately.
*/
get showContent(): boolean;
set showContent(val: boolean);
/**
* The sidebar widget.
*/
get sidebar(): NavigationPage;
set sidebar(val: NavigationPage);
/**
* The sidebar position.
*
* If set to `GTK_PACK_START`, the sidebar is displayed before the content,
* and the sidebar will be the root page when collapsed.
*
* If set to `GTK_PACK_END`, the sidebar is displayed after the content,
* and the content will be the root page.
*/
get sidebar_position(): Gtk.PackType;
set sidebar_position(val: Gtk.PackType);
/**
* The sidebar position.
*
* If set to `GTK_PACK_START`, the sidebar is displayed before the content,
* and the sidebar will be the root page when collapsed.
*
* If set to `GTK_PACK_END`, the sidebar is displayed after the content,
* and the content will be the root page.
*/
get sidebarPosition(): Gtk.PackType;
set sidebarPosition(val: Gtk.PackType);
/**
* The preferred sidebar width as a fraction of the total width.
*
* The preferred width is additionally limited by
* [property`NavigationSplitView:`min-sidebar-width] and
* [property`NavigationSplitView:`max-sidebar-width].
*
* The sidebar widget can be allocated with larger width if its own minimum
* width exceeds the preferred width.
*/
get sidebar_width_fraction(): number;
set sidebar_width_fraction(val: number);
/**
* The preferred sidebar width as a fraction of the total width.
*
* The preferred width is additionally limited by
* [property`NavigationSplitView:`min-sidebar-width] and
* [property`NavigationSplitView:`max-sidebar-width].
*
* The sidebar widget can be allocated with larger width if its own minimum
* width exceeds the preferred width.
*/
get sidebarWidthFraction(): number;
set sidebarWidthFraction(val: number);
/**
* The length unit for minimum and maximum sidebar widths.
*
* See [property`NavigationSplitView:`min-sidebar-width] and
* [property`NavigationSplitView:`max-sidebar-width].
*/
get sidebar_width_unit(): LengthUnit;
set sidebar_width_unit(val: LengthUnit);
/**
* The length unit for minimum and maximum sidebar widths.
*
* See [property`NavigationSplitView:`min-sidebar-width] and
* [property`NavigationSplitView:`max-sidebar-width].
*/
get sidebarWidthUnit(): LengthUnit;
set sidebarWidthUnit(val: LengthUnit);
// Constructors
constructor(properties?: Partial<NavigationSplitView.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): NavigationSplitView;
// Methods
/**
* Gets whether `self` is collapsed.
* @returns whether @self is collapsed
*/
get_collapsed(): boolean;
/**
* Sets the content widget for `self`.
* @returns the content widget
*/
get_content(): NavigationPage | null;
/**
* Gets the maximum sidebar width for `self`.
* @returns the maximum width
*/
get_max_sidebar_width(): number;
/**
* Gets the minimum sidebar width for `self`.
* @returns the minimum width
*/
get_min_sidebar_width(): number;
/**
* Gets which page is visible when `self` is collapsed.
* @returns whether to show content when collapsed
*/
get_show_content(): boolean;
/**
* Gets the sidebar widget for `self`.
* @returns the sidebar widget
*/
get_sidebar(): NavigationPage | null;
/**
* Gets the sidebar position for `self`.
* @returns the sidebar position for @self
*/
get_sidebar_position(): Gtk.PackType;
/**
* Gets the preferred sidebar width fraction for `self`.
* @returns the preferred width fraction
*/
get_sidebar_width_fraction(): number;
/**
* Gets the length unit for minimum and maximum sidebar widths.
* @returns the length unit
*/
get_sidebar_width_unit(): LengthUnit;
/**
* Sets whether `self` is collapsed.
*
* When collapsed, the children are put inside an [class`NavigationView]`,
* otherwise they are displayed side by side.
*
* The [property`NavigationSplitView:`show-content] controls which child is
* visible while collapsed.
* @param collapsed whether @self is collapsed
*/
set_collapsed(collapsed: boolean): void;
/**
* Sets the content widget for `self`.
* @param content the content widget
*/
set_content(content?: NavigationPage | null): void;
/**
* Sets the maximum sidebar width for `self`.
*
* Maximum width is affected by
* [property`NavigationSplitView:`sidebar-width-unit].
*
* The sidebar widget can still be allocated with larger width if its own
* minimum width exceeds it.
* @param width the maximum width
*/
set_max_sidebar_width(width: number): void;
/**
* Sets the minimum sidebar width for `self`.
*
* Minimum width is affected by
* [property`NavigationSplitView:`sidebar-width-unit].
*
* The sidebar widget can still be allocated with larger width if its own
* minimum width exceeds it.
* @param width the minimum width
*/
set_min_sidebar_width(width: number): void;
/**
* Sets which page is visible when `self` is collapsed.
*
* If set to `TRUE`, the content widget will be the visible page when
* [property`NavigationSplitView:`collapsed] is `TRUE`; otherwise the sidebar
* widget will be visible.
*
* If the split view is already collapsed, the visible page changes immediately.
* @param show_content whether to show content when collapsed
*/
set_show_content(show_content: boolean): void;
/**
* Sets the sidebar widget for `self`.
* @param sidebar the sidebar widget
*/
set_sidebar(sidebar?: NavigationPage | null): void;
/**
* Sets the sidebar position for `self`.
*
* If set to `GTK_PACK_START`, the sidebar is displayed before the content,
* and the sidebar will be the root page when collapsed.
*
* If set to `GTK_PACK_END`, the sidebar is displayed after the content,
* and the content will be the root page.
* @param position the new position
*/
set_sidebar_position(position: Gtk.PackType | null): void;
/**
* Sets the preferred sidebar width as a fraction of the total width of `self`.
*
* The preferred width is additionally limited by
* [property`NavigationSplitView:`min-sidebar-width] and
* [property`NavigationSplitView:`max-sidebar-width].
*
* The sidebar widget can be allocated with larger width if its own minimum
* width exceeds the preferred width.
* @param fraction the preferred width fraction
*/
set_sidebar_width_fraction(fraction: number): void;
/**
* Sets the length unit for minimum and maximum sidebar widths.
*
* See [property`NavigationSplitView:`min-sidebar-width] and
* [property`NavigationSplitView:`max-sidebar-width].
* @param unit the length unit
*/
set_sidebar_width_unit(unit: LengthUnit | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 NavigationView {
// Signal callback interfaces
interface GetNextPage {
(): NavigationPage | null;
}
interface Popped {
(page: NavigationPage): void;
}
interface Pushed {
(): void;
}
interface Replaced {
(): void;
}
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Swipeable.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
animate_transitions: boolean;
animateTransitions: boolean;
hhomogeneous: boolean;
navigation_stack: Gio.ListModel;
navigationStack: Gio.ListModel;
pop_on_escape: boolean;
popOnEscape: boolean;
vhomogeneous: boolean;
visible_page: NavigationPage;
visiblePage: NavigationPage;
visible_page_tag: string;
visiblePageTag: string;
}
}
/**
* A page-based navigation container.
*
* <picture>
* <source srcset="navigation-view-dark.png" media="(prefers-color-scheme: dark)">
* <img src="navigation-view.png" alt="navigation-view">
* </picture>
*
* `AdwNavigationView` presents one child at a time, similar to
* [class`Gtk`.Stack].
*
* `AdwNavigationView` can only contain [class`NavigationPage]` children.
*
* It maintains a navigation stack that can be controlled with
* [method`NavigationView`.push] and [method`NavigationView`.pop]. The whole
* navigation stack can also be replaced using [method`NavigationView`.replace].
*
* `AdwNavigationView` allows to manage pages statically or dynamically.
*
* Static pages can be added using the [method`NavigationView`.add] method. The
* `AdwNavigationView` will keep a reference to these pages, but they aren't
* accessible to the user until [method`NavigationView`.push] is called (except
* for the first page, which is pushed automatically). Use the
* [method`NavigationView`.remove] method to remove them. This is useful for
* applications that have a small number of unique pages and just need
* navigation between them.
*
* Dynamic pages are automatically destroyed once they are popped off the
* navigation stack. To add a page like this, push it using the
* [method`NavigationView`.push] method without calling
* [method`NavigationView`.add] first.
*
* ## Tags
*
* Static pages, as well as any pages in the navigation stack, can be accessed
* by their [property`NavigationPage:`tag]. For example,
* [method`NavigationView`.push_by_tag] can be used to push a static page that's
* not in the navigation stack without having to keep a reference to it manually.
*
* ## Header Bar Integration
*
* When used inside `AdwNavigationView`, [class`HeaderBar]` will automatically
* display a back button that can be used to go back to the previous page when
* possible. The button also has a context menu, allowing to pop multiple pages
* at once, potentially across multiple navigation views.
*
* Set [property`HeaderBar:`show-back-button] to `FALSE` to disable this behavior
* in rare scenarios where it's unwanted.
*
* `AdwHeaderBar` will also display the title of the `AdwNavigationPage` it's
* placed into, so most applications shouldn't need to customize it at all.
*
* ## Shortcuts and Gestures
*
* `AdwNavigationView` supports the following shortcuts for going to the
* previous page:
*
* - <kbd>Escape</kbd> (unless [property`NavigationView:`pop-on-escape] is set to
* `FALSE`)
* - <kbd>Alt</kbd>+<kbd>←</kbd>
* - Back mouse button
*
* Additionally, it supports interactive gestures:
*
* - One-finger swipe towards the right on touchscreens
* - Scrolling towards the right on touchpads (usually two-finger swipe)
*
* These gestures have transitions enabled regardless of the
* [property`NavigationView:`animate-transitions] value.
*
* Applications can also enable shortcuts for pushing another page onto the
* navigation stack via connecting to the [signal`NavigationView:`:get-next-page]
* signal, in that case the following shortcuts are supported:
*
* - <kbd>Alt</kbd>+<kbd>→</kbd>
* - Forward mouse button
* - Swipe/scrolling towards the left
*
* For right-to-left locales, the gestures and shortcuts are reversed.
*
* [property`NavigationPage:`can-pop] can be used to disable them, along with the
* header bar back buttons.
*
* ## Actions
*
* `AdwNavigationView` defines actions for controlling the navigation stack.
* actions for controlling the navigation stack:
*
* - `navigation.push` takes a string parameter specifying the tag of the page to
* push, and is equivalent to calling [method`NavigationView`.push_by_tag].
*
* - `navigation.pop` doesn't take any parameters and pops the current page from
* the navigation stack, equivalent to calling [method`NavigationView`.pop].
*
* ## `AdwNavigationView` as `GtkBuildable`
*
* `AdwNavigationView` allows to add pages as children, equivalent to using the
* [method`NavigationView`.add] method.
*
* Example of an `AdwNavigationView` UI definition:
*
* ```xml
* <object class="AdwNavigationView">
* <child>
* <object class="AdwNavigationPage">
* <property name="title" translatable="yes">Page 1</property>
* <property name="child">
* <object class="AdwToolbarView">
* <child type="top">
* <object class="AdwHeaderBar"/>
* </child>
* <property name="content">
* <object class="GtkButton">
* <property name="label" translatable="yes">Open Page 2</property>
* <property name="halign">center</property>
* <property name="valign">center</property>
* <property name="action-name">navigation.push</property>
* <property name="action-target">'page-2'</property>
* <style>
* <class name="pill"/>
* </style>
* </object>
* </property>
* </object>
* </property>
* </object>
* </child>
* <child>
* <object class="AdwNavigationPage">
* <property name="title" translatable="yes">Page 2</property>
* <property name="tag">page-2</property>
* <property name="child">
* <object class="AdwToolbarView">
* <child type="top">
* <object class="AdwHeaderBar"/>
* </child>
* <property name="content">
* <!-- ... -->
* </property>
* </object>
* </property>
* </object>
* </child>
* </object>
* ```
*
* <picture>
* <source srcset="navigation-view-example-dark.png" media="(prefers-color-scheme: dark)">
* <img src="navigation-view-example.png" alt="navigation-view-example">
* </picture>
*
* ## CSS nodes
*
* `AdwNavigationView` has a single CSS node with the name `navigation-view`.
*
* ## Accessibility
*
* `AdwNavigationView` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.
*/
class NavigationView
extends Gtk.Widget
implements Swipeable, Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget
{
static $gtype: GObject.GType<NavigationView>;
// Properties
/**
* Whether to animate page transitions.
*
* Gesture-based transitions are always animated.
*/
get animate_transitions(): boolean;
set animate_transitions(val: boolean);
/**
* Whether to animate page transitions.
*
* Gesture-based transitions are always animated.
*/
get animateTransitions(): boolean;
set animateTransitions(val: boolean);
/**
* Whether the view is horizontally homogeneous.
*
* If the view is horizontally homogeneous, it allocates the same width for
* all pages.
*
* If it's not, the page may change width when a different page becomes
* visible.
*/
get hhomogeneous(): boolean;
set hhomogeneous(val: boolean);
/**
* A list model that contains the pages in navigation stack.
*
* The pages are sorted from root page to visible page.
*
* This can be used to keep an up-to-date view.
*/
get navigation_stack(): Gio.ListModel;
/**
* A list model that contains the pages in navigation stack.
*
* The pages are sorted from root page to visible page.
*
* This can be used to keep an up-to-date view.
*/
get navigationStack(): Gio.ListModel;
/**
* Whether pressing Escape pops the current page.
*
* Applications using `AdwNavigationView` to implement a browser may want to
* disable it.
*/
get pop_on_escape(): boolean;
set pop_on_escape(val: boolean);
/**
* Whether pressing Escape pops the current page.
*
* Applications using `AdwNavigationView` to implement a browser may want to
* disable it.
*/
get popOnEscape(): boolean;
set popOnEscape(val: boolean);
/**
* Whether the view is vertically homogeneous.
*
* If the view is vertically homogeneous, it allocates the same height for
* all pages.
*
* If it's not, the view may change height when a different page becomes
* visible.
*/
get vhomogeneous(): boolean;
set vhomogeneous(val: boolean);
/**
* The currently visible page.
*/
get visible_page(): NavigationPage;
/**
* The currently visible page.
*/
get visiblePage(): NavigationPage;
/**
* The tag of the currently visible page.
*/
get visible_page_tag(): string;
/**
* The tag of the currently visible page.
*/
get visiblePageTag(): string;
// Constructors
constructor(properties?: Partial<NavigationView.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): NavigationView;
// 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: 'get-next-page', callback: (_source: this) => NavigationPage | null): number;
connect_after(signal: 'get-next-page', callback: (_source: this) => NavigationPage | null): number;
emit(signal: 'get-next-page'): void;
connect(signal: 'popped', callback: (_source: this, page: NavigationPage) => void): number;
connect_after(signal: 'popped', callback: (_source: this, page: NavigationPage) => void): number;
emit(signal: 'popped', page: NavigationPage): void;
connect(signal: 'pushed', callback: (_source: this) => void): number;
connect_after(signal: 'pushed', callback: (_source: this) => void): number;
emit(signal: 'pushed'): void;
connect(signal: 'replaced', callback: (_source: this) => void): number;
connect_after(signal: 'replaced', callback: (_source: this) => void): number;
emit(signal: 'replaced'): void;
// Methods
/**
* Permanently adds `page` to `self`.
*
* Any page that has been added will stay in `self` even after being popped from
* the navigation stack.
*
* Adding a page while no page is visible will automatically push it to the
* navigation stack.
*
* See [method`NavigationView`.remove].
* @param page the page to add
*/
add(page: NavigationPage): void;
/**
* Finds a page in `self` by its tag.
*
* See [property`NavigationPage:`tag].
* @param tag a page tag
* @returns the page with the given tag
*/
find_page(tag: string): NavigationPage | null;
/**
* Gets whether `self` animates page transitions.
* @returns whether to animate page transitions
*/
get_animate_transitions(): boolean;
/**
* Gets whether `self` is horizontally homogeneous.
* @returns whether @self is horizontally homogeneous
*/
get_hhomogeneous(): boolean;
/**
* Returns a [iface`Gio`.ListModel] that contains the pages in navigation stack.
*
* The pages are sorted from root page to visible page.
*
* This can be used to keep an up-to-date view.
* @returns a list model for the navigation stack
*/
get_navigation_stack(): Gio.ListModel;
/**
* Gets whether pressing Escape pops the current page on `self`.
* @returns whether to pop the current page
*/
get_pop_on_escape(): boolean;
/**
* Gets the previous page for `page`.
*
* If `page` is in the navigation stack, returns the page popping `page` will
* reveal.
*
* If `page` is the root page or is not in the navigation stack, returns `NULL`.
* @param page a page in @self
* @returns the previous page
*/
get_previous_page(page: NavigationPage): NavigationPage | null;
/**
* Gets whether `self` is vertically homogeneous.
* @returns whether @self is vertically homogeneous
*/
get_vhomogeneous(): boolean;
/**
* Gets the currently visible page in `self`.
* @returns the currently visible page
*/
get_visible_page(): NavigationPage | null;
/**
* Gets the tag of the currently visible page in `self`.
* @returns the tag of the currently visible page
*/
get_visible_page_tag(): string | null;
/**
* Pops the visible page from the navigation stack.
*
* Does nothing if the navigation stack contains less than two pages.
*
* If [method`NavigationView`.add] hasn't been called, the page is automatically
* removed.
*
* [signal`NavigationView:`:popped] will be emitted for the current visible page.
*
* See [method`NavigationView`.pop_to_page] and
* [method`NavigationView`.pop_to_tag].
* @returns `TRUE` if a page has been popped
*/
pop(): boolean;
/**
* Pops pages from the navigation stack until `page` is visible.
*
* `page` must be in the navigation stack.
*
* If [method`NavigationView`.add] hasn't been called for any of the popped pages,
* they are automatically removed.
*
* [signal`NavigationView:`:popped] will be be emitted for each of the popped
* pages.
*
* See [method`NavigationView`.pop] and [method`NavigationView`.pop_to_tag].
* @param page the page to pop to
* @returns `TRUE` if any pages have been popped
*/
pop_to_page(page: NavigationPage): boolean;
/**
* Pops pages from the navigation stack until page with the tag `tag` is visible.
*
* The page must be in the navigation stack.
*
* If [method`NavigationView`.add] hasn't been called for any of the popped pages,
* they are automatically removed.
*
* [signal`NavigationView:`:popped] will be emitted for each of the popped pages.
*
* See [method`NavigationView`.pop_to_page] and [property`NavigationPage:`tag].
* @param tag a page tag
* @returns `TRUE` if any pages have been popped
*/
pop_to_tag(tag: string): boolean;
/**
* Pushes `page` onto the navigation stack.
*
* If [method`NavigationView`.add] hasn't been called, the page is automatically
* removed once it's popped.
*
* [signal`NavigationView:`:pushed] will be emitted for `page`.
*
* See [method`NavigationView`.push_by_tag].
* @param page the page to push
*/
push(page: NavigationPage): void;
/**
* Pushes the page with the tag `tag` onto the navigation stack.
*
* If [method`NavigationView`.add] hasn't been called, the page is automatically
* removed once it's popped.
*
* [signal`NavigationView:`:pushed] will be emitted for the page.
*
* See [method`NavigationView`.push] and [property`NavigationPage:`tag].
* @param tag the page tag
*/
push_by_tag(tag: string): void;
/**
* Removes `page` from `self`.
*
* If `page` is currently in the navigation stack, it will be removed once it's
* popped. Otherwise, it's removed immediately.
*
* See [method`NavigationView`.add].
* @param page the page to remove
*/
remove(page: NavigationPage): void;
/**
* Replaces the current navigation stack with `pages`.
*
* The last page becomes the visible page.
*
* Replacing the navigation stack has no animation.
*
* If [method`NavigationView`.add] hasn't been called for any pages that are no
* longer in the navigation stack, they are automatically removed.
*
* `n_pages` can be 0, in that case no page will be visible after calling this
* method. This can be useful for removing all pages from `self`.
*
* The [signal`NavigationView:`:replaced] signal will be emitted.
*
* See [method`NavigationView`.replace_with_tags].
* @param pages the new navigation stack
*/
replace(pages: NavigationPage[]): void;
/**
* Replaces the current navigation stack with pages with the tags `tags`.
*
* The last page becomes the visible page.
*
* Replacing the navigation stack has no animation.
*
* If [method`NavigationView`.add] hasn't been called for any pages that are no
* longer in the navigation stack, they are automatically removed.
*
* `n_tags` can be 0, in that case no page will be visible after calling this
* method. This can be useful for removing all pages from `self`.
*
* The [signal`NavigationView:`:replaced] signal will be emitted.
*
* See [method`NavigationView`.replace] and [property`NavigationPage:`tag].
* @param tags tags of the pages in the navigation stack
*/
replace_with_tags(tags: string[]): void;
/**
* Sets whether `self` should animate page transitions.
*
* Gesture-based transitions are always animated.
* @param animate_transitions whether to animate page transitions
*/
set_animate_transitions(animate_transitions: boolean): void;
/**
* Sets `self` to be horizontally homogeneous or not.
*
* If the view is horizontally homogeneous, it allocates the same width for
* all pages.
*
* If it's not, the view may change width when a different page becomes visible.
* @param hhomogeneous whether to make @self horizontally homogeneous
*/
set_hhomogeneous(hhomogeneous: boolean): void;
/**
* Sets whether pressing Escape pops the current page on `self`.
*
* Applications using `AdwNavigationView` to implement a browser may want to
* disable it.
* @param pop_on_escape whether to pop the current page when pressing Escape
*/
set_pop_on_escape(pop_on_escape: boolean): void;
/**
* Sets `self` to be vertically homogeneous or not.
*
* If the view is vertically homogeneous, it allocates the same height for
* all pages.
*
* If it's not, the view may change height when a different page becomes
* visible.
* @param vhomogeneous whether to make @self vertically homogeneous
*/
set_vhomogeneous(vhomogeneous: boolean): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// Inherited methods
/**
* Gets the progress `self` will snap back to after the gesture is canceled.
* @returns the cancel progress, unitless
*/
get_cancel_progress(): number;
/**
* Gets the swipe distance of `self`.
*
* This corresponds to how many pixels 1 unit represents.
* @returns the swipe distance in pixels
*/
get_distance(): number;
/**
* Gets the current progress of `self`.
* @returns the current progress, unitless
*/
get_progress(): number;
/**
* Gets the snap points of `self`.
*
* Each snap point represents a progress value that is considered acceptable to
* end the swipe on.
* @returns the snap points
*/
get_snap_points(): number[];
/**
* Gets the area `self` can start a swipe from for the given direction and
* gesture type.
*
* This can be used to restrict swipes to only be possible from a certain area,
* for example, to only allow edge swipes, or to have a draggable element and
* ignore swipes elsewhere.
*
* If not implemented, the default implementation returns the allocation of
* `self,` allowing swipes from anywhere.
* @param navigation_direction the direction of the swipe
* @param is_drag whether the swipe is caused by a dragging gesture
*/
get_swipe_area(navigation_direction: NavigationDirection | null, is_drag: boolean): Gdk.Rectangle;
/**
* Gets the progress `self` will snap back to after the gesture is canceled.
*/
vfunc_get_cancel_progress(): number;
/**
* Gets the swipe distance of `self`.
*
* This corresponds to how many pixels 1 unit represents.
*/
vfunc_get_distance(): number;
/**
* Gets the current progress of `self`.
*/
vfunc_get_progress(): number;
/**
* Gets the snap points of `self`.
*
* Each snap point represents a progress value that is considered acceptable to
* end the swipe on.
*/
vfunc_get_snap_points(): number[];
/**
* Gets the area `self` can start a swipe from for the given direction and
* gesture type.
*
* This can be used to restrict swipes to only be possible from a certain area,
* for example, to only allow edge swipes, or to have a draggable element and
* ignore swipes elsewhere.
*
* If not implemented, the default implementation returns the allocation of
* `self,` allowing swipes from anywhere.
* @param navigation_direction the direction of the swipe
* @param is_drag whether the swipe is caused by a dragging gesture
*/
vfunc_get_swipe_area(navigation_direction: NavigationDirection, is_drag: boolean): Gdk.Rectangle;
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: string): void;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): 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 OverlaySplitView {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Swipeable.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
collapsed: boolean;
content: Gtk.Widget;
enable_hide_gesture: boolean;
enableHideGesture: boolean;
enable_show_gesture: boolean;
enableShowGesture: boolean;
max_sidebar_width: number;
maxSidebarWidth: number;
min_sidebar_width: number;
minSidebarWidth: number;
pin_sidebar: boolean;
pinSidebar: boolean;
show_sidebar: boolean;
showSidebar: boolean;
sidebar: Gtk.Widget;
sidebar_position: Gtk.PackType;
sidebarPosition: Gtk.PackType;
sidebar_width_fraction: number;
sidebarWidthFraction: number;
sidebar_width_unit: LengthUnit;
sidebarWidthUnit: LengthUnit;
}
}
/**
* A widget presenting sidebar and content side by side or as an overlay.
*
* <picture>
* <source srcset="overlay-split-view-dark.png" media="(prefers-color-scheme: dark)">
* <img src="overlay-split-view.png" alt="overlay-split-view">
* </picture>
* <picture>
* <source srcset="overlay-split-view-collapsed-dark.png" media="(prefers-color-scheme: dark)">
* <img src="overlay-split-view-collapsed.png" alt="overlay-split-view-collapsed">
* </picture>
*
* `AdwOverlaySplitView` has two children: sidebar and content, and displays
* them side by side.
*
* When [property`OverlaySplitView:`collapsed] is set to `TRUE`, the sidebar is
* instead shown as an overlay above the content widget.
*
* The sidebar can be hidden or shown using the
* [property`OverlaySplitView:`show-sidebar] property.
*
* Sidebar can be displayed before or after the content, this can be controlled
* with the [property`OverlaySplitView:`sidebar-position] property.
*
* Collapsing the split view automatically hides the sidebar widget, and
* uncollapsing it shows the sidebar. If this behavior is not desired, the
* [property`OverlaySplitView:`pin-sidebar] property can be used to override it.
*
* `AdwOverlaySplitView` supports an edge swipe gesture for showing the sidebar,
* and a swipe from the sidebar for hiding it. Gestures are only supported on
* touchscreen, but not touchpad. Gestures can be controlled with the
* [property`OverlaySplitView:`enable-show-gesture] and
* [property`OverlaySplitView:`enable-hide-gesture] properties.
*
* See also [class`NavigationSplitView]`.
*
* `AdwOverlaySplitView` is typically used together with an [class`Breakpoint]`
* setting the `collapsed` property to `TRUE` on small widths, as follows:
*
* ```xml
* <object class="AdwWindow">
* <property name="default-width">800</property>
* <property name="default-height">800</property>
* <child>
* <object class="AdwBreakpoint">
* <condition>max-width: 400sp</condition>
* <setter object="split_view" property="collapsed">True</setter>
* </object>
* </child>
* <property name="content">
* <object class="AdwOverlaySplitView" id="split_view">
* <property name="sidebar">
* <!-- ... -->
* </property>
* <property name="content">
* <!-- ... -->
* </property>
* </object>
* </property>
* </object>
* ```
*
* `AdwOverlaySplitView` is often used for implementing the
* [utility pane](https://developer.gnome.org/hig/patterns/containers/utility-panes.html)
* pattern.
*
* ## Sizing
*
* When not collapsed, `AdwOverlaySplitView` changes the sidebar width
* depending on its own width.
*
* If possible, it tries to allocate a fraction of the total width, controlled
* with the [property`OverlaySplitView:`sidebar-width-fraction] property.
*
* The sidebar also has minimum and maximum sizes, controlled with the
* [property`OverlaySplitView:`min-sidebar-width] and
* [property`OverlaySplitView:`max-sidebar-width] properties.
*
* The minimum and maximum sizes are using the length unit specified with the
* [property`OverlaySplitView:`sidebar-width-unit].
*
* By default, sidebar is using 25% of the total width, with 180sp as the
* minimum size and 280sp as the maximum size.
*
* When collapsed, the preferred width fraction is ignored and the sidebar uses
* [property`OverlaySplitView:`max-sidebar-width] when possible.
*
* ## Header Bar Integration
*
* When used inside `AdwOverlaySplitView`, [class`HeaderBar]` will automatically
* hide the window buttons in the middle.
*
* ## `AdwOverlaySplitView` as `GtkBuildable`
*
* The `AdwOverlaySplitView` implementation of the [iface`Gtk`.Buildable]
* interface supports setting the sidebar widget by specifying “sidebar” as the
* “type” attribute of a `<child>` element, Specifying “content” child type or
* omitting it results in setting the content widget.
*
* ## CSS nodes
*
* `AdwOverlaySplitView` has a single CSS node with the name
* `overlay-split-view`.
*
* It contains two nodes with the name `widget`, containing the sidebar and
* content children.
*
* When not collapsed, they have the `.sidebar-view` and `.content-view` style
* classes respectively.
*
* ```
* overlay-split-view
* ├── widget.sidebar-pane
* │ ╰── [sidebar child]
* ╰── widget.content-pane
* ╰── [content child]
* ```
*
* When collapsed, the one containing the sidebar child has the `.background`
* style class and the other one has no style classes.
*
* ```
* overlay-split-view
* ├── widget.background
* │ ╰── [sidebar child]
* ╰── widget
* ╰── [content child]
* ```
*
* ## Accessibility
*
* `AdwOverlaySplitView` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.
*/
class OverlaySplitView
extends Gtk.Widget
implements Swipeable, Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget
{
static $gtype: GObject.GType<OverlaySplitView>;
// Properties
/**
* Whether the split view is collapsed.
*
* When collapsed, the sidebar widget is presented as an overlay above the
* content widget, otherwise they are displayed side by side.
*/
get collapsed(): boolean;
set collapsed(val: boolean);
/**
* The content widget.
*/
get content(): Gtk.Widget;
set content(val: Gtk.Widget);
/**
* Whether the sidebar can be closed with a swipe gesture.
*
* Only touchscreen swipes are supported.
*/
get enable_hide_gesture(): boolean;
set enable_hide_gesture(val: boolean);
/**
* Whether the sidebar can be closed with a swipe gesture.
*
* Only touchscreen swipes are supported.
*/
get enableHideGesture(): boolean;
set enableHideGesture(val: boolean);
/**
* Whether the sidebar can be opened with an edge swipe gesture.
*
* Only touchscreen swipes are supported.
*/
get enable_show_gesture(): boolean;
set enable_show_gesture(val: boolean);
/**
* Whether the sidebar can be opened with an edge swipe gesture.
*
* Only touchscreen swipes are supported.
*/
get enableShowGesture(): boolean;
set enableShowGesture(val: boolean);
/**
* The maximum sidebar width.
*
* Maximum width is affected by
* [property`OverlaySplitView:`sidebar-width-unit].
*
* The sidebar widget can still be allocated with larger width if its own
* minimum width exceeds it.
*/
get max_sidebar_width(): number;
set max_sidebar_width(val: number);
/**
* The maximum sidebar width.
*
* Maximum width is affected by
* [property`OverlaySplitView:`sidebar-width-unit].
*
* The sidebar widget can still be allocated with larger width if its own
* minimum width exceeds it.
*/
get maxSidebarWidth(): number;
set maxSidebarWidth(val: number);
/**
* The minimum sidebar width.
*
* Minimum width is affected by
* [property`OverlaySplitView:`sidebar-width-unit].
*
* The sidebar widget can still be allocated with larger width if its own
* minimum width exceeds it.
*/
get min_sidebar_width(): number;
set min_sidebar_width(val: number);
/**
* The minimum sidebar width.
*
* Minimum width is affected by
* [property`OverlaySplitView:`sidebar-width-unit].
*
* The sidebar widget can still be allocated with larger width if its own
* minimum width exceeds it.
*/
get minSidebarWidth(): number;
set minSidebarWidth(val: number);
/**
* Whether the sidebar widget is pinned.
*
* By default, collapsing `self` automatically hides the sidebar widget, and
* uncollapsing it shows the sidebar. If set to `TRUE`, sidebar visibility
* never changes on its own.
*/
get pin_sidebar(): boolean;
set pin_sidebar(val: boolean);
/**
* Whether the sidebar widget is pinned.
*
* By default, collapsing `self` automatically hides the sidebar widget, and
* uncollapsing it shows the sidebar. If set to `TRUE`, sidebar visibility
* never changes on its own.
*/
get pinSidebar(): boolean;
set pinSidebar(val: boolean);
/**
* Whether the sidebar widget is shown.
*/
get show_sidebar(): boolean;
set show_sidebar(val: boolean);
/**
* Whether the sidebar widget is shown.
*/
get showSidebar(): boolean;
set showSidebar(val: boolean);
/**
* The sidebar widget.
*/
get sidebar(): Gtk.Widget;
set sidebar(val: Gtk.Widget);
/**
* The sidebar position.
*
* If it's set to `GTK_PACK_START`, the sidebar is displayed before the content,
* if `GTK_PACK_END`, it's displayed after the content.
*/
get sidebar_position(): Gtk.PackType;
set sidebar_position(val: Gtk.PackType);
/**
* The sidebar position.
*
* If it's set to `GTK_PACK_START`, the sidebar is displayed before the content,
* if `GTK_PACK_END`, it's displayed after the content.
*/
get sidebarPosition(): Gtk.PackType;
set sidebarPosition(val: Gtk.PackType);
/**
* The preferred sidebar width as a fraction of the total width.
*
* The preferred width is additionally limited by
* [property`OverlaySplitView:`min-sidebar-width] and
* [property`OverlaySplitView:`max-sidebar-width].
*
* The sidebar widget can be allocated with larger width if its own minimum
* width exceeds the preferred width.
*/
get sidebar_width_fraction(): number;
set sidebar_width_fraction(val: number);
/**
* The preferred sidebar width as a fraction of the total width.
*
* The preferred width is additionally limited by
* [property`OverlaySplitView:`min-sidebar-width] and
* [property`OverlaySplitView:`max-sidebar-width].
*
* The sidebar widget can be allocated with larger width if its own minimum
* width exceeds the preferred width.
*/
get sidebarWidthFraction(): number;
set sidebarWidthFraction(val: number);
/**
* The length unit for minimum and maximum sidebar widths.
*
* See [property`OverlaySplitView:`min-sidebar-width] and
* [property`OverlaySplitView:`max-sidebar-width].
*/
get sidebar_width_unit(): LengthUnit;
set sidebar_width_unit(val: LengthUnit);
/**
* The length unit for minimum and maximum sidebar widths.
*
* See [property`OverlaySplitView:`min-sidebar-width] and
* [property`OverlaySplitView:`max-sidebar-width].
*/
get sidebarWidthUnit(): LengthUnit;
set sidebarWidthUnit(val: LengthUnit);
// Constructors
constructor(properties?: Partial<OverlaySplitView.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): OverlaySplitView;
// Methods
/**
* Gets whether `self` is collapsed.
* @returns whether @self is collapsed
*/
get_collapsed(): boolean;
/**
* Gets the content widget for `self`.
* @returns the content widget for @self
*/
get_content(): Gtk.Widget | null;
/**
* Gets whether `self` can be closed with a swipe gesture.
* @returns `TRUE` if @self can be closed with a swipe gesture
*/
get_enable_hide_gesture(): boolean;
/**
* Gets whether `self` can be opened with an edge swipe gesture.
* @returns `TRUE` if @self can be opened with a swipe gesture
*/
get_enable_show_gesture(): boolean;
/**
* Gets the maximum sidebar width for `self`.
* @returns the maximum width
*/
get_max_sidebar_width(): number;
/**
* Gets the minimum sidebar width for `self`.
* @returns the minimum width
*/
get_min_sidebar_width(): number;
/**
* Gets whether the sidebar widget is pinned for `self`.
* @returns whether if the sidebar widget is pinned
*/
get_pin_sidebar(): boolean;
/**
* Gets whether the sidebar widget is shown for `self`.
* @returns `TRUE` if the sidebar widget is shown
*/
get_show_sidebar(): boolean;
/**
* Gets the sidebar widget for `self`.
* @returns the sidebar widget for @self
*/
get_sidebar(): Gtk.Widget | null;
/**
* Gets the sidebar position for `self`.
* @returns the sidebar position for @self
*/
get_sidebar_position(): Gtk.PackType;
/**
* Gets the preferred sidebar width fraction for `self`.
* @returns the preferred width fraction
*/
get_sidebar_width_fraction(): number;
/**
* Gets the length unit for minimum and maximum sidebar widths.
* @returns the length unit
*/
get_sidebar_width_unit(): LengthUnit;
/**
* Sets whether `self` view is collapsed.
*
* When collapsed, the sidebar widget is presented as an overlay above the
* content widget, otherwise they are displayed side by side.
* @param collapsed whether @self is collapsed
*/
set_collapsed(collapsed: boolean): void;
/**
* Sets the content widget for `self`.
* @param content the content widget
*/
set_content(content?: Gtk.Widget | null): void;
/**
* Sets whether `self` can be closed with a swipe gesture.
*
* Only touchscreen swipes are supported.
* @param enable_hide_gesture whether @self can be closed with a swipe gesture
*/
set_enable_hide_gesture(enable_hide_gesture: boolean): void;
/**
* Sets whether `self` can be opened with an edge swipe gesture.
*
* Only touchscreen swipes are supported.
* @param enable_show_gesture whether @self can be opened with a swipe gesture
*/
set_enable_show_gesture(enable_show_gesture: boolean): void;
/**
* Sets the maximum sidebar width for `self`.
*
* Maximum width is affected by [property`OverlaySplitView:`sidebar-width-unit].
*
* The sidebar widget can still be allocated with larger width if its own
* minimum width exceeds it.
* @param width the maximum width
*/
set_max_sidebar_width(width: number): void;
/**
* Sets the minimum sidebar width for `self`.
*
* Minimum width is affected by [property`OverlaySplitView:`sidebar-width-unit].
*
* The sidebar widget can still be allocated with larger width if its own
* minimum width exceeds it.
* @param width the minimum width
*/
set_min_sidebar_width(width: number): void;
/**
* Sets whether the sidebar widget is pinned for `self`.
*
* By default, collapsing `self` automatically hides the sidebar widget, and
* uncollapsing it shows the sidebar. If set to `TRUE`, sidebar visibility never
* changes on its own.
* @param pin_sidebar whether to pin the sidebar widget
*/
set_pin_sidebar(pin_sidebar: boolean): void;
/**
* Sets whether the sidebar widget is shown for `self`.
* @param show_sidebar whether to show the sidebar widget
*/
set_show_sidebar(show_sidebar: boolean): void;
/**
* Sets the sidebar widget for `self`.
* @param sidebar the sidebar widget
*/
set_sidebar(sidebar?: Gtk.Widget | null): void;
/**
* Sets the sidebar position for `self`.
*
* If it's set to `GTK_PACK_START`, the sidebar is displayed before the content,
* if `GTK_PACK_END`, it's displayed after the content.
* @param position the new position
*/
set_sidebar_position(position: Gtk.PackType | null): void;
/**
* Sets the preferred sidebar width as a fraction of the total width of `self`.
*
* The preferred width is additionally limited by
* [property`OverlaySplitView:`min-sidebar-width] and
* [property`OverlaySplitView:`max-sidebar-width].
*
* The sidebar widget can be allocated with larger width if its own minimum
* width exceeds the preferred width.
* @param fraction the preferred width fraction
*/
set_sidebar_width_fraction(fraction: number): void;
/**
* Sets the length unit for minimum and maximum sidebar widths.
*
* See [property`OverlaySplitView:`min-sidebar-width] and
* [property`OverlaySplitView:`max-sidebar-width].
* @param unit the length unit
*/
set_sidebar_width_unit(unit: LengthUnit | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// Inherited methods
/**
* Gets the progress `self` will snap back to after the gesture is canceled.
* @returns the cancel progress, unitless
*/
get_cancel_progress(): number;
/**
* Gets the swipe distance of `self`.
*
* This corresponds to how many pixels 1 unit represents.
* @returns the swipe distance in pixels
*/
get_distance(): number;
/**
* Gets the current progress of `self`.
* @returns the current progress, unitless
*/
get_progress(): number;
/**
* Gets the snap points of `self`.
*
* Each snap point represents a progress value that is considered acceptable to
* end the swipe on.
* @returns the snap points
*/
get_snap_points(): number[];
/**
* Gets the area `self` can start a swipe from for the given direction and
* gesture type.
*
* This can be used to restrict swipes to only be possible from a certain area,
* for example, to only allow edge swipes, or to have a draggable element and
* ignore swipes elsewhere.
*
* If not implemented, the default implementation returns the allocation of
* `self,` allowing swipes from anywhere.
* @param navigation_direction the direction of the swipe
* @param is_drag whether the swipe is caused by a dragging gesture
*/
get_swipe_area(navigation_direction: NavigationDirection | null, is_drag: boolean): Gdk.Rectangle;
/**
* Gets the progress `self` will snap back to after the gesture is canceled.
*/
vfunc_get_cancel_progress(): number;
/**
* Gets the swipe distance of `self`.
*
* This corresponds to how many pixels 1 unit represents.
*/
vfunc_get_distance(): number;
/**
* Gets the current progress of `self`.
*/
vfunc_get_progress(): number;
/**
* Gets the snap points of `self`.
*
* Each snap point represents a progress value that is considered acceptable to
* end the swipe on.
*/
vfunc_get_snap_points(): number[];
/**
* Gets the area `self` can start a swipe from for the given direction and
* gesture type.
*
* This can be used to restrict swipes to only be possible from a certain area,
* for example, to only allow edge swipes, or to have a draggable element and
* ignore swipes elsewhere.
*
* If not implemented, the default implementation returns the allocation of
* `self,` allowing swipes from anywhere.
* @param navigation_direction the direction of the swipe
* @param is_drag whether the swipe is caused by a dragging gesture
*/
vfunc_get_swipe_area(navigation_direction: NavigationDirection, is_drag: boolean): Gdk.Rectangle;
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: string): void;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): 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 PasswordEntryRow {
// Constructor properties interface
interface ConstructorProps
extends EntryRow.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Actionable.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Editable.ConstructorProps {}
}
/**
* A [class`EntryRow]` tailored for entering secrets.
*
* <picture>
* <source srcset="password-entry-row-dark.png" media="(prefers-color-scheme: dark)">
* <img src="password-entry-row.png" alt="password-entry-row">
* </picture>
*
* It does not show its contents in clear text, does not allow to copy it to the
* clipboard, and shows a warning when Caps Lock is engaged. If the underlying
* platform allows it, `AdwPasswordEntryRow` will also place the text in a
* non-pageable memory area, to avoid it being written out to disk by the
* operating system.
*
* It offer a way to reveal the contents in clear text.
*
* ## CSS Nodes
*
* `AdwPasswordEntryRow` has a single CSS node with name `row` that carries
* `.entry` and `.password` style classes.
*/
class PasswordEntryRow
extends EntryRow
implements Gtk.Accessible, Gtk.Actionable, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Editable
{
static $gtype: GObject.GType<PasswordEntryRow>;
// Constructors
constructor(properties?: Partial<PasswordEntryRow.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): PasswordEntryRow;
// Inherited properties
/**
* The current position of the insertion cursor in chars.
*/
get cursor_position(): number;
/**
* The current position of the insertion cursor in chars.
*/
get cursorPosition(): number;
/**
* Whether the entry contents can be edited.
*/
get editable(): boolean;
set editable(val: boolean);
/**
* If undo/redo should be enabled for the editable.
*/
get enable_undo(): boolean;
set enable_undo(val: boolean);
/**
* If undo/redo should be enabled for the editable.
*/
get enableUndo(): boolean;
set enableUndo(val: boolean);
/**
* The desired maximum width of the entry, in characters.
*/
get max_width_chars(): number;
set max_width_chars(val: number);
/**
* The desired maximum width of the entry, in characters.
*/
get maxWidthChars(): number;
set maxWidthChars(val: number);
/**
* The position of the opposite end of the selection from the cursor in chars.
*/
get selection_bound(): number;
/**
* The position of the opposite end of the selection from the cursor in chars.
*/
get selectionBound(): number;
/**
* The contents of the entry.
*/
get text(): string;
set text(val: string);
/**
* Number of characters to leave space for in the entry.
*/
get width_chars(): number;
set width_chars(val: number);
/**
* Number of characters to leave space for in the entry.
*/
get widthChars(): number;
set widthChars(val: number);
/**
* The horizontal alignment, from 0 (left) to 1 (right).
*
* Reversed for RTL layouts.
*/
get xalign(): number;
set xalign(val: number);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// Inherited methods
/**
* Retrieves the accessible platform state from the editable delegate.
*
* This is an helper function to retrieve the accessible state for
* `GtkEditable` interface implementations using a delegate pattern.
*
* You should call this function in your editable widget implementation
* of the [vfunc`Gtk`.Accessible.get_platform_state] virtual function, for
* instance:
*
* ```c
* static void
* accessible_interface_init (GtkAccessibleInterface *iface)
* {
* iface->get_platform_state = your_editable_get_accessible_platform_state;
* }
*
* static gboolean
* your_editable_get_accessible_platform_state (GtkAccessible *accessible,
* GtkAccessiblePlatformState state)
* {
* return gtk_editable_delegate_get_accessible_platform_state (GTK_EDITABLE (accessible), state);
* }
* ```
*
* Note that the widget which is the delegate *must* be a direct child of
* this widget, otherwise your implementation of [vfunc`Gtk`.Accessible.get_platform_state]
* might not even be called, as the platform change will originate from
* the parent of the delegate, and, as a result, will not work properly.
*
* So, if you can't ensure the direct child condition, you should give the
* delegate the %GTK_ACCESSIBLE_ROLE_TEXT_BOX role, or you can
* change your tree to allow this function to work.
* @param state what kind of accessible state to retrieve
* @returns the accessible platform state of the delegate
*/
delegate_get_accessible_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Deletes the currently selected text of the editable.
*
* This call doesnt do anything if there is no selected text.
*/
delete_selection(): void;
/**
* Deletes a sequence of characters.
*
* The characters that are deleted are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is
* negative, then the characters deleted are those from `start_pos` to
* the end of the text.
*
* Note that the positions are specified in characters, not bytes.
* @param start_pos start position
* @param end_pos end position
*/
delete_text(start_pos: number, end_pos: number): void;
/**
* Undoes the setup done by [method`Gtk`.Editable.init_delegate].
*
* This is a helper function that should be called from dispose,
* before removing the delegate object.
*/
finish_delegate(): void;
/**
* Gets the alignment of the editable.
* @returns the alignment
*/
get_alignment(): number;
/**
* Retrieves a sequence of characters.
*
* The characters that are retrieved are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is negative,
* then the characters retrieved are those characters from `start_pos` to
* the end of the text.
*
* Note that positions are specified in characters, not bytes.
* @param start_pos start of text
* @param end_pos end of text
* @returns a pointer to the contents of the widget as a string. This string is allocated by the `GtkEditable` implementation and should be freed by the caller.
*/
get_chars(start_pos: number, end_pos: number): string;
/**
* Gets the `GtkEditable` that `editable` is delegating its
* implementation to.
*
* Typically, the delegate is a [class`Gtk`.Text] widget.
* @returns the delegate `GtkEditable`
*/
get_delegate(): Gtk.Editable | null;
/**
* Retrieves whether `editable` is editable.
* @returns %TRUE if @editable is editable.
*/
get_editable(): boolean;
/**
* Gets if undo/redo actions are enabled for `editable`
* @returns %TRUE if undo is enabled
*/
get_enable_undo(): boolean;
/**
* Retrieves the desired maximum width of `editable,` in characters.
* @returns the maximum width of the entry, in characters
*/
get_max_width_chars(): number;
/**
* Retrieves the current position of the cursor relative
* to the start of the content of the editable.
*
* Note that this position is in characters, not in bytes.
* @returns the cursor position
*/
get_position(): number;
/**
* Retrieves the selection bound of the editable.
*
* `start_pos` will be filled with the start of the selection and
* `end_pos` with end. If no text was selected both will be identical
* and %FALSE will be returned.
*
* Note that positions are specified in characters, not bytes.
* @returns %TRUE if there is a non-empty selection, %FALSE otherwise
*/
get_selection_bounds(): [boolean, number, number];
/**
* Retrieves the contents of `editable`.
*
* The returned string is owned by GTK and must not be modified or freed.
* @returns a pointer to the contents of the editable
*/
get_text(): string;
/**
* Gets the number of characters of space reserved
* for the contents of the editable.
* @returns number of chars to request space for, or negative if unset
*/
get_width_chars(): number;
/**
* Sets up a delegate for `GtkEditable`.
*
* This is assuming that the get_delegate vfunc in the `GtkEditable`
* interface has been set up for the `editable'`s type.
*
* This is a helper function that should be called in instance init,
* after creating the delegate object.
*/
init_delegate(): void;
/**
* Inserts `length` bytes of `text` into the contents of the
* widget, at position `position`.
*
* Note that the position is in characters, not in bytes.
* The function updates `position` to point after the newly
* inserted text.
* @param text the text to insert
* @param length the length of the text in bytes, or -1
* @param position location of the position text will be inserted at
*/
insert_text(text: string, length: number, position: number): number;
/**
* Selects a region of text.
*
* The characters that are selected are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is
* negative, then the characters selected are those characters from
* `start_pos` to the end of the text.
*
* Note that positions are specified in characters, not bytes.
* @param start_pos start of region
* @param end_pos end of region
*/
select_region(start_pos: number, end_pos: number): void;
/**
* Sets the alignment for the contents of the editable.
*
* This controls the horizontal positioning of the contents when
* the displayed text is shorter than the width of the editable.
* @param xalign The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts
*/
set_alignment(xalign: number): void;
/**
* Determines if the user can edit the text in the editable widget.
* @param is_editable %TRUE if the user is allowed to edit the text in the widget
*/
set_editable(is_editable: boolean): void;
/**
* If enabled, changes to `editable` will be saved for undo/redo
* actions.
*
* This results in an additional copy of text changes and are not
* stored in secure memory. As such, undo is forcefully disabled
* when [property`Gtk`.Text:visibility] is set to %FALSE.
* @param enable_undo if undo/redo should be enabled
*/
set_enable_undo(enable_undo: boolean): void;
/**
* Sets the desired maximum width in characters of `editable`.
* @param n_chars the new desired maximum width, in characters
*/
set_max_width_chars(n_chars: number): void;
/**
* Sets the cursor position in the editable to the given value.
*
* The cursor is displayed before the character with the given (base 0)
* index in the contents of the editable. The value must be less than
* or equal to the number of characters in the editable. A value of -1
* indicates that the position should be set after the last character
* of the editable. Note that `position` is in characters, not in bytes.
* @param position the position of the cursor
*/
set_position(position: number): void;
/**
* Sets the text in the editable to the given value.
*
* This is replacing the current contents.
* @param text the text to set
*/
set_text(text: string): void;
/**
* Changes the size request of the editable to be about the
* right size for `n_chars` characters.
*
* Note that it changes the size request, the size can still
* be affected by how you pack the widget into containers.
* If `n_chars` is -1, the size reverts to the default size.
* @param n_chars width in chars
*/
set_width_chars(n_chars: number): void;
vfunc_changed(): void;
/**
* Deletes a sequence of characters.
*
* The characters that are deleted are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is
* negative, then the characters deleted are those from `start_pos` to
* the end of the text.
*
* Note that the positions are specified in characters, not bytes.
* @param start_pos start position
* @param end_pos end position
*/
vfunc_delete_text(start_pos: number, end_pos: number): void;
/**
* Deletes a sequence of characters.
*
* The characters that are deleted are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is
* negative, then the characters deleted are those from `start_pos` to
* the end of the text.
*
* Note that the positions are specified in characters, not bytes.
* @param start_pos start position
* @param end_pos end position
*/
vfunc_do_delete_text(start_pos: number, end_pos: number): void;
/**
* Inserts `length` bytes of `text` into the contents of the
* widget, at position `position`.
*
* Note that the position is in characters, not in bytes.
* The function updates `position` to point after the newly
* inserted text.
* @param text the text to insert
* @param length the length of the text in bytes, or -1
* @param position location of the position text will be inserted at
*/
vfunc_do_insert_text(text: string, length: number, position: number): number;
/**
* Gets the `GtkEditable` that `editable` is delegating its
* implementation to.
*
* Typically, the delegate is a [class`Gtk`.Text] widget.
*/
vfunc_get_delegate(): Gtk.Editable | null;
/**
* Retrieves the selection bound of the editable.
*
* `start_pos` will be filled with the start of the selection and
* `end_pos` with end. If no text was selected both will be identical
* and %FALSE will be returned.
*
* Note that positions are specified in characters, not bytes.
*/
vfunc_get_selection_bounds(): [boolean, number, number];
/**
* Retrieves the contents of `editable`.
*
* The returned string is owned by GTK and must not be modified or freed.
*/
vfunc_get_text(): string;
/**
* Inserts `length` bytes of `text` into the contents of the
* widget, at position `position`.
*
* Note that the position is in characters, not in bytes.
* The function updates `position` to point after the newly
* inserted text.
* @param text the text to insert
* @param length the length of the text in bytes, or -1
* @param position location of the position text will be inserted at
*/
vfunc_insert_text(text: string, length: number, position: number): number;
/**
* Selects a region of text.
*
* The characters that are selected are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is
* negative, then the characters selected are those characters from
* `start_pos` to the end of the text.
*
* Note that positions are specified in characters, not bytes.
* @param start_pos start of region
* @param end_pos end of region
*/
vfunc_set_selection_bounds(start_pos: number, end_pos: number): 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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace PreferencesDialog {
// Constructor properties interface
interface ConstructorProps
extends Dialog.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.ShortcutManager.ConstructorProps {
search_enabled: boolean;
searchEnabled: boolean;
visible_page: Gtk.Widget;
visiblePage: Gtk.Widget;
visible_page_name: string;
visiblePageName: string;
}
}
/**
* A dialog showing application's preferences.
*
* <picture>
* <source srcset="preferences-dialog-dark.png" media="(prefers-color-scheme: dark)">
* <img src="preferences-dialog.png" alt="preferences-dialog">
* </picture>
*
* The `AdwPreferencesDialog` widget presents an application's preferences
* gathered into pages and groups. The preferences are searchable by the user.
*
* ## Actions
*
* `AdwPrefencesDialog` defines the `navigation.pop` action, it doesn't take any
* parameters and pops the current subpage from the navigation stack, equivalent
* to calling [method`PreferencesDialog`.pop_subpage].
*
* ## CSS nodes
*
* `AdwPreferencesDialog` has a main CSS node with the name `dialog` and the
* style class `.preferences`.
*/
class PreferencesDialog
extends Dialog
implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.ShortcutManager
{
static $gtype: GObject.GType<PreferencesDialog>;
// Properties
/**
* Whether search is enabled.
*/
get search_enabled(): boolean;
set search_enabled(val: boolean);
/**
* Whether search is enabled.
*/
get searchEnabled(): boolean;
set searchEnabled(val: boolean);
/**
* The currently visible page.
*/
get visible_page(): Gtk.Widget;
set visible_page(val: Gtk.Widget);
/**
* The currently visible page.
*/
get visiblePage(): Gtk.Widget;
set visiblePage(val: Gtk.Widget);
/**
* The name of the currently visible page.
*
* See [property`AdwPreferencesDialog:`visible-page].
*/
get visible_page_name(): string;
set visible_page_name(val: string);
/**
* The name of the currently visible page.
*
* See [property`AdwPreferencesDialog:`visible-page].
*/
get visiblePageName(): string;
set visiblePageName(val: string);
// Constructors
constructor(properties?: Partial<PreferencesDialog.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): PreferencesDialog;
// Methods
/**
* Adds a preferences page to `self`.
* @param page the page to add
*/
add(page: PreferencesPage): void;
/**
* Displays `toast`.
*
* See [method`ToastOverlay`.add_toast].
* @param toast a toast
*/
add_toast(toast: Toast): void;
/**
* Gets whether search is enabled for `self`.
* @returns whether search is enabled for @self.
*/
get_search_enabled(): boolean;
/**
* Gets the currently visible page of `self`.
* @returns the visible page
*/
get_visible_page(): PreferencesPage | null;
/**
* Gets the name of currently visible page of `self`.
* @returns the name of the visible page
*/
get_visible_page_name(): string | null;
/**
* Pop the visible page from the subpage stack of `self`.
* @returns `TRUE` if a page has been popped
*/
pop_subpage(): boolean;
/**
* Pushes `page` onto the subpage stack of `self`.
*
* The page will be automatically removed when popped.
* @param page the subpage
*/
push_subpage(page: NavigationPage): void;
/**
* Removes a page from `self`.
* @param page the page to remove
*/
remove(page: PreferencesPage): void;
/**
* Sets whether search is enabled for `self`.
* @param search_enabled whether search is enabled
*/
set_search_enabled(search_enabled: boolean): void;
/**
* Makes `page` the visible page of `self`.
* @param page a page of @self
*/
set_visible_page(page: PreferencesPage): void;
/**
* Makes the page with the given name visible.
*
* See [property`PreferencesDialog:`visible-page].
* @param name the name of the page to make visible
*/
set_visible_page_name(name: string): void;
// Inherited methods
/**
* Add a `GtkShortcutController` to be managed.
* @param controller
*/
vfunc_add_controller(controller: Gtk.ShortcutController): void;
/**
* Remove a `GtkShortcutController` that had previously
* been added
* @param controller
*/
vfunc_remove_controller(controller: Gtk.ShortcutController): 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 PreferencesGroup {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
description: string;
header_suffix: Gtk.Widget;
headerSuffix: Gtk.Widget;
separate_rows: boolean;
separateRows: boolean;
title: string;
}
}
/**
* A group of preference rows.
*
* <picture>
* <source srcset="preferences-group-dark.png" media="(prefers-color-scheme: dark)">
* <img src="preferences-group.png" alt="preferences-group">
* </picture>
*
* An `AdwPreferencesGroup` represents a group or tightly related preferences,
* which in turn are represented by [class`PreferencesRow]`.
*
* To summarize the role of the preferences it gathers, a group can have both a
* title and a description. The title will be used by [class`PreferencesDialog]`
* to let the user look for a preference.
*
* The [property`PreferencesGroup:`separate-rows] property can be used to
* separate the rows within the group, same as when using the
* [`.boxed-list-separate`](style-classes.html#boxed-lists-cards) style class
* instead of `.boxed-list`.
*
* ## AdwPreferencesGroup as GtkBuildable
*
* The `AdwPreferencesGroup` implementation of the [iface`Gtk`.Buildable] interface
* supports adding [class`PreferencesRow]`s to the list by omitting "type". If "type"
* is omitted and the widget isn't a [class`PreferencesRow]` the child is added to
* a box below the list.
*
* When the "type" attribute of a child is `header-suffix`, the child
* is set as the suffix on the end of the title and description.
*
* ## CSS nodes
*
* `AdwPreferencesGroup` has a single CSS node with name `preferencesgroup`.
*
* ## Accessibility
*
* `AdwPreferencesGroup` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.
*/
class PreferencesGroup extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<PreferencesGroup>;
// Properties
/**
* The description for this group of preferences.
*/
get description(): string;
set description(val: string);
/**
* The header suffix widget.
*
* Displayed above the list, next to the title and description.
*
* Suffixes are commonly used to show a button or a spinner for the whole
* group.
*/
get header_suffix(): Gtk.Widget;
set header_suffix(val: Gtk.Widget);
/**
* The header suffix widget.
*
* Displayed above the list, next to the title and description.
*
* Suffixes are commonly used to show a button or a spinner for the whole
* group.
*/
get headerSuffix(): Gtk.Widget;
set headerSuffix(val: Gtk.Widget);
/**
* Whether to separate rows.
*
* Equivalent to using the
* [`.boxed-list-separate`](style-classes.html#boxed-lists-cards) style class
* on a [class`Gtk`.ListBox] instead of `.boxed-list`.
*/
get separate_rows(): boolean;
set separate_rows(val: boolean);
/**
* Whether to separate rows.
*
* Equivalent to using the
* [`.boxed-list-separate`](style-classes.html#boxed-lists-cards) style class
* on a [class`Gtk`.ListBox] instead of `.boxed-list`.
*/
get separateRows(): boolean;
set separateRows(val: boolean);
/**
* The title for this group of preferences.
*/
get title(): string;
set title(val: string);
// Constructors
constructor(properties?: Partial<PreferencesGroup.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): PreferencesGroup;
// Methods
/**
* Adds a child to `self`.
* @param child the widget to add
*/
add(child: Gtk.Widget): void;
/**
* Gets the description of `self`.
* @returns the description of @self
*/
get_description(): string | null;
/**
* Gets the suffix for `self'`s header.
* @returns the suffix for @self's header.
*/
get_header_suffix(): Gtk.Widget | null;
/**
* Gets whether `self'`s rows are separated.
* @returns whether rows are separated
*/
get_separate_rows(): boolean;
/**
* Gets the title of `self`.
* @returns the title of @self
*/
get_title(): string;
/**
* Removes a child from `self`.
* @param child the child to remove
*/
remove(child: Gtk.Widget): void;
/**
* Sets the description for `self`.
* @param description the description
*/
set_description(description?: string | null): void;
/**
* Sets the suffix for `self'`s header.
*
* Displayed above the list, next to the title and description.
*
* Suffixes are commonly used to show a button or a spinner for the whole group.
* @param suffix the suffix to set
*/
set_header_suffix(suffix?: Gtk.Widget | null): void;
/**
* Sets whether `self'`s rows are separated.
*
* Equivalent to using the
* [`.boxed-list-separate`](style-classes.html#boxed-lists-cards) style class
* on a [class`Gtk`.ListBox] instead of `.boxed-list`.
* @param separate_rows whether to separate rows
*/
set_separate_rows(separate_rows: boolean): void;
/**
* Sets the title for `self`.
* @param title the title
*/
set_title(title: string): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 PreferencesPage {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
banner: Banner;
description: string;
description_centered: boolean;
descriptionCentered: boolean;
icon_name: string;
iconName: string;
name: string;
title: string;
use_underline: boolean;
useUnderline: boolean;
}
}
/**
* A page from [class`PreferencesDialog]`.
*
* <picture>
* <source srcset="preferences-page-dark.png" media="(prefers-color-scheme: dark)">
* <img src="preferences-page.png" alt="preferences-page">
* </picture>
*
* The `AdwPreferencesPage` widget gathers preferences groups into a single page
* of a preferences window.
*
* ## CSS nodes
*
* `AdwPreferencesPage` has a single CSS node with name `preferencespage`.
*
* ## Accessibility
*
* `AdwPreferencesPage` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.
*/
class PreferencesPage extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<PreferencesPage>;
// Properties
/**
* A [class`Banner]` displayed at the top of the page.
*/
get banner(): Banner;
set banner(val: Banner);
/**
* The description to be displayed at the top of the page.
*/
get description(): string;
set description(val: string);
/**
* Whether the description should be centered.
*/
get description_centered(): boolean;
set description_centered(val: boolean);
/**
* Whether the description should be centered.
*/
get descriptionCentered(): boolean;
set descriptionCentered(val: boolean);
/**
* The icon name for this page.
*/
get icon_name(): string;
set icon_name(val: string);
/**
* The icon name for this page.
*/
get iconName(): string;
set iconName(val: string);
/**
* The name of this page.
*/
get name(): string;
set name(val: string);
/**
* The title for this page.
*/
get title(): string;
set title(val: string);
/**
* Whether an embedded underline in the title indicates a mnemonic.
*/
get use_underline(): boolean;
set use_underline(val: boolean);
/**
* Whether an embedded underline in the title indicates a mnemonic.
*/
get useUnderline(): boolean;
set useUnderline(val: boolean);
// Constructors
constructor(properties?: Partial<PreferencesPage.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): PreferencesPage;
// Methods
/**
* Adds a preferences group to `self`.
* @param group the group to add
*/
add(group: PreferencesGroup): void;
/**
* Gets the banner displayed at the top of the page.
* @returns the banner for @self
*/
get_banner(): Banner | null;
/**
* Gets the description of `self`.
* @returns the description of @self.
*/
get_description(): string;
/**
* Gets whether the description is centered.
* @returns whether the description is centered.
*/
get_description_centered(): boolean;
/**
* Gets the icon name for `self`.
* @returns the icon name for @self
*/
get_icon_name(): string | null;
/**
* Gets the name of `self`.
* @returns the name of @self
*/
get_name(): string | null;
// Conflicted with Gtk.Widget.get_name
get_name(...args: never[]): any;
/**
* Gets the title of `self`.
* @returns the title of @self.
*/
get_title(): string;
/**
* Gets whether an embedded underline in the title indicates a mnemonic.
* @returns whether an embedded underline in the title indicates a mnemonic
*/
get_use_underline(): boolean;
/**
* Removes a group from `self`.
* @param group the group to remove
*/
remove(group: PreferencesGroup): void;
/**
* Scrolls the scrolled window of `self` to the top.
*/
scroll_to_top(): void;
/**
* Sets the banner displayed at the top of the page.
* @param banner the banner to display at the top of the page
*/
set_banner(banner?: Banner | null): void;
/**
* Sets the description of `self`.
*
* The description is displayed at the top of the page.
* @param description the description
*/
set_description(description: string): void;
/**
* Sets whether the description should be centered.
* @param centered If the description should be centered
*/
set_description_centered(centered: boolean): void;
/**
* Sets the icon name for `self`.
* @param icon_name the icon name
*/
set_icon_name(icon_name?: string | null): void;
/**
* Sets the name of `self`.
* @param name the name
*/
set_name(name?: string | null): void;
// Conflicted with Gtk.Widget.set_name
set_name(...args: never[]): any;
/**
* Sets the title of `self`.
* @param title the title
*/
set_title(title: string): void;
/**
* Sets whether an embedded underline in the title indicates a mnemonic.
* @param use_underline `TRUE` if underlines in the text indicate mnemonics
*/
set_use_underline(use_underline: boolean): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 PreferencesRow {
// Constructor properties interface
interface ConstructorProps
extends Gtk.ListBoxRow.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Actionable.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
title: string;
title_selectable: boolean;
titleSelectable: boolean;
use_markup: boolean;
useMarkup: boolean;
use_underline: boolean;
useUnderline: boolean;
}
}
/**
* A [class`Gtk`.ListBoxRow] used to present preferences.
*
* The `AdwPreferencesRow` widget has a title that [class`PreferencesDialog]`
* will use to let the user look for a preference. It doesn't present the title
* in any way and lets you present the preference as you please.
*
* [class`ActionRow]` and its derivatives are convenient to use as preference
* rows as they take care of presenting the preference's title while letting you
* compose the inputs of the preference around it.
*/
class PreferencesRow
extends Gtk.ListBoxRow
implements Gtk.Accessible, Gtk.Actionable, Gtk.Buildable, Gtk.ConstraintTarget
{
static $gtype: GObject.GType<PreferencesRow>;
// Properties
/**
* The title of the preference represented by this row.
*
* The title is interpreted as Pango markup unless
* [property`PreferencesRow:`use-markup] is set to `FALSE`.
*/
get title(): string;
set title(val: string);
/**
* Whether the user can copy the title from the label.
*
* See also [property`Gtk`.Label:selectable].
*/
get title_selectable(): boolean;
set title_selectable(val: boolean);
/**
* Whether the user can copy the title from the label.
*
* See also [property`Gtk`.Label:selectable].
*/
get titleSelectable(): boolean;
set titleSelectable(val: boolean);
/**
* Whether to use Pango markup for the title label.
*
* Subclasses may also use it for other labels, such as subtitle.
*
* See also [func`Pango`.parse_markup].
*/
get use_markup(): boolean;
set use_markup(val: boolean);
/**
* Whether to use Pango markup for the title label.
*
* Subclasses may also use it for other labels, such as subtitle.
*
* See also [func`Pango`.parse_markup].
*/
get useMarkup(): boolean;
set useMarkup(val: boolean);
/**
* Whether an embedded underline in the title indicates a mnemonic.
*/
get use_underline(): boolean;
set use_underline(val: boolean);
/**
* Whether an embedded underline in the title indicates a mnemonic.
*/
get useUnderline(): boolean;
set useUnderline(val: boolean);
// Constructors
constructor(properties?: Partial<PreferencesRow.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): PreferencesRow;
// Methods
/**
* Gets the title of the preference represented by `self`.
* @returns the title
*/
get_title(): string;
/**
* Gets whether the user can copy the title from the label
* @returns whether the user can copy the title from the label
*/
get_title_selectable(): boolean;
/**
* Gets whether to use Pango markup for the title label.
* @returns whether to use markup
*/
get_use_markup(): boolean;
/**
* Gets whether an embedded underline in the title indicates a mnemonic.
* @returns whether an embedded underline in the title indicates a mnemonic
*/
get_use_underline(): boolean;
/**
* Sets the title of the preference represented by `self`.
*
* The title is interpreted as Pango markup unless
* [property`PreferencesRow:`use-markup] is set to `FALSE`.
* @param title the title
*/
set_title(title: string): void;
/**
* Sets whether the user can copy the title from the label
*
* See also [property`Gtk`.Label:selectable].
* @param title_selectable `TRUE` if the user can copy the title from the label
*/
set_title_selectable(title_selectable: boolean): void;
/**
* Sets whether to use Pango markup for the title label.
*
* Subclasses may also use it for other labels, such as subtitle.
*
* See also [func`Pango`.parse_markup].
* @param use_markup whether to use markup
*/
set_use_markup(use_markup: boolean): void;
/**
* Sets whether an embedded underline in the title indicates a mnemonic.
* @param use_underline `TRUE` if underlines in the text indicate mnemonics
*/
set_use_underline(use_underline: boolean): void;
// Inherited properties
/**
* The name of the action with which this widget should be associated.
*/
get action_name(): string;
set action_name(val: string);
/**
* The name of the action with which this widget should be associated.
*/
get actionName(): string;
set actionName(val: string);
/**
* The target value of the actionable widget's action.
*/
get action_target(): GLib.Variant;
set action_target(val: GLib.Variant);
/**
* The target value of the actionable widget's action.
*/
get actionTarget(): GLib.Variant;
set actionTarget(val: GLib.Variant);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// Inherited methods
/**
* Gets the action name for `actionable`.
* @returns the action name
*/
get_action_name(): string | null;
/**
* Gets the current target value of `actionable`.
* @returns the current target value
*/
get_action_target_value(): GLib.Variant | null;
/**
* Specifies the name of the action with which this widget should be
* associated.
*
* If `action_name` is %NULL then the widget will be unassociated from
* any previous action.
*
* Usually this function is used when the widget is located (or will be
* located) within the hierarchy of a `GtkApplicationWindow`.
*
* Names are of the form “win.save” or “app.quit” for actions on the
* containing [class`ApplicationWindow]` or its associated [class`Application]`,
* respectively. This is the same form used for actions in the [class`Gio`.Menu]
* associated with the window.
* @param action_name an action name
*/
set_action_name(action_name?: string | null): void;
/**
* Sets the target value of an actionable widget.
*
* If `target_value` is %NULL then the target value is unset.
*
* The target value has two purposes. First, it is used as the parameter
* to activation of the action associated with the `GtkActionable` widget.
* Second, it is used to determine if the widget should be rendered as
* “active” — the widget is active if the state is equal to the given target.
*
* Consider the example of associating a set of buttons with a [iface`Gio`.Action]
* with string state in a typical “radio button” situation. Each button
* will be associated with the same action, but with a different target
* value for that action. Clicking on a particular button will activate
* the action with the target of that button, which will typically cause
* the actions state to change to that value. Since the actions state
* is now equal to the target value of the button, the button will now
* be rendered as active (and the other buttons, with different targets,
* rendered inactive).
* @param target_value a [struct@GLib.Variant] to set as the target value
*/
set_action_target_value(target_value?: GLib.Variant | null): void;
/**
* Sets the action-name and associated string target value of an
* actionable widget.
*
* `detailed_action_name` is a string in the format accepted by
* [func`Gio`.Action.parse_detailed_name].
* @param detailed_action_name the detailed action name
*/
set_detailed_action_name(detailed_action_name: string): void;
/**
* Gets the action name for `actionable`.
*/
vfunc_get_action_name(): string | null;
/**
* Gets the current target value of `actionable`.
*/
vfunc_get_action_target_value(): GLib.Variant | null;
/**
* Specifies the name of the action with which this widget should be
* associated.
*
* If `action_name` is %NULL then the widget will be unassociated from
* any previous action.
*
* Usually this function is used when the widget is located (or will be
* located) within the hierarchy of a `GtkApplicationWindow`.
*
* Names are of the form “win.save” or “app.quit” for actions on the
* containing [class`ApplicationWindow]` or its associated [class`Application]`,
* respectively. This is the same form used for actions in the [class`Gio`.Menu]
* associated with the window.
* @param action_name an action name
*/
vfunc_set_action_name(action_name?: string | null): void;
/**
* Sets the target value of an actionable widget.
*
* If `target_value` is %NULL then the target value is unset.
*
* The target value has two purposes. First, it is used as the parameter
* to activation of the action associated with the `GtkActionable` widget.
* Second, it is used to determine if the widget should be rendered as
* “active” — the widget is active if the state is equal to the given target.
*
* Consider the example of associating a set of buttons with a [iface`Gio`.Action]
* with string state in a typical “radio button” situation. Each button
* will be associated with the same action, but with a different target
* value for that action. Clicking on a particular button will activate
* the action with the target of that button, which will typically cause
* the actions state to change to that value. Since the actions state
* is now equal to the target value of the button, the button will now
* be rendered as active (and the other buttons, with different targets,
* rendered inactive).
* @param target_value a [struct@GLib.Variant] to set as the target value
*/
vfunc_set_action_target_value(target_value?: GLib.Variant | null): 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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace PreferencesWindow {
// Constructor properties interface
interface ConstructorProps
extends Window.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Native.ConstructorProps,
Gtk.Root.ConstructorProps,
Gtk.ShortcutManager.ConstructorProps {
can_navigate_back: boolean;
canNavigateBack: boolean;
search_enabled: boolean;
searchEnabled: boolean;
visible_page: Gtk.Widget;
visiblePage: Gtk.Widget;
visible_page_name: string;
visiblePageName: string;
}
}
/**
* A window to present an application's preferences.
*
* <picture>
* <source srcset="preferences-window-dark.png" media="(prefers-color-scheme: dark)">
* <img src="preferences-window.png" alt="preferences-window">
* </picture>
*
* The `AdwPreferencesWindow` widget presents an application's preferences
* gathered into pages and groups. The preferences are searchable by the user.
*
* ## CSS nodes
*
* `AdwPreferencesWindow` has a main CSS node with the name `window` and the
* style class `.preferences`.
*/
class PreferencesWindow
extends Window
implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Native, Gtk.Root, Gtk.ShortcutManager
{
static $gtype: GObject.GType<PreferencesWindow>;
// Properties
/**
* Whether gestures and shortcuts for closing subpages are enabled.
*
* The supported gestures are:
*
* - One-finger swipe on touchscreens
* - Horizontal scrolling on touchpads (usually two-finger swipe)
* - Back mouse button
*
* The keyboard back key is also supported, as well as the
* <kbd>Alt</kbd>+<kbd>←</kbd> shortcut.
*
* For right-to-left locales, gestures and shortcuts are reversed.
*
* Has no effect for subpages added with
* [method`PreferencesWindow`.push_subpage].
*/
get can_navigate_back(): boolean;
set can_navigate_back(val: boolean);
/**
* Whether gestures and shortcuts for closing subpages are enabled.
*
* The supported gestures are:
*
* - One-finger swipe on touchscreens
* - Horizontal scrolling on touchpads (usually two-finger swipe)
* - Back mouse button
*
* The keyboard back key is also supported, as well as the
* <kbd>Alt</kbd>+<kbd>←</kbd> shortcut.
*
* For right-to-left locales, gestures and shortcuts are reversed.
*
* Has no effect for subpages added with
* [method`PreferencesWindow`.push_subpage].
*/
get canNavigateBack(): boolean;
set canNavigateBack(val: boolean);
/**
* Whether search is enabled.
*/
get search_enabled(): boolean;
set search_enabled(val: boolean);
/**
* Whether search is enabled.
*/
get searchEnabled(): boolean;
set searchEnabled(val: boolean);
/**
* The currently visible page.
*/
get visible_page(): Gtk.Widget;
set visible_page(val: Gtk.Widget);
/**
* The currently visible page.
*/
get visiblePage(): Gtk.Widget;
set visiblePage(val: Gtk.Widget);
/**
* The name of the currently visible page.
*
* See [property`PreferencesWindow:`visible-page].
*/
get visible_page_name(): string;
set visible_page_name(val: string);
/**
* The name of the currently visible page.
*
* See [property`PreferencesWindow:`visible-page].
*/
get visiblePageName(): string;
set visiblePageName(val: string);
// Constructors
constructor(properties?: Partial<PreferencesWindow.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): PreferencesWindow;
// Methods
/**
* Adds a preferences page to `self`.
* @param page the page to add
*/
add(page: PreferencesPage): void;
/**
* Displays `toast`.
*
* See [method`ToastOverlay`.add_toast].
* @param toast a toast
*/
add_toast(toast: Toast): void;
/**
* Closes the current subpage.
*
* If there is no presented subpage, this does nothing.
*/
close_subpage(): void;
/**
* Gets whether gestures and shortcuts for closing subpages are enabled.
* @returns whether gestures and shortcuts are enabled.
*/
get_can_navigate_back(): boolean;
/**
* Gets whether search is enabled for `self`.
* @returns whether search is enabled for @self.
*/
get_search_enabled(): boolean;
/**
* Gets the currently visible page of `self`.
* @returns the visible page
*/
get_visible_page(): PreferencesPage | null;
/**
* Gets the name of currently visible page of `self`.
* @returns the name of the visible page
*/
get_visible_page_name(): string | null;
/**
* Pop the visible page from the subpage stack of `self`.
* @returns `TRUE` if a page has been popped
*/
pop_subpage(): boolean;
/**
* Sets `subpage` as the window's subpage and opens it.
*
* The transition can be cancelled by the user, in which case visible child will
* change back to the previously visible child.
* @param subpage the subpage
*/
present_subpage(subpage: Gtk.Widget): void;
/**
* Pushes `page` onto the subpage stack of `self`.
*
* The page will be automatically removed when popped.
* @param page the subpage
*/
push_subpage(page: NavigationPage): void;
/**
* Removes a page from `self`.
* @param page the page to remove
*/
remove(page: PreferencesPage): void;
/**
* Sets whether gestures and shortcuts for closing subpages are enabled.
*
* The supported gestures are:
*
* - One-finger swipe on touchscreens
* - Horizontal scrolling on touchpads (usually two-finger swipe)
* - Back mouse button
*
* The keyboard back key is also supported, as well as the
* <kbd>Alt</kbd>+<kbd>←</kbd> shortcut.
*
* For right-to-left locales, gestures and shortcuts are reversed.
*
* Has no effect for subpages added with [method`PreferencesWindow`.push_subpage].
* @param can_navigate_back the new value
*/
set_can_navigate_back(can_navigate_back: boolean): void;
/**
* Sets whether search is enabled for `self`.
* @param search_enabled whether search is enabled
*/
set_search_enabled(search_enabled: boolean): void;
/**
* Makes `page` the visible page of `self`.
* @param page a page of @self
*/
set_visible_page(page: PreferencesPage): void;
/**
* Makes the page with the given name visible.
*
* See [property`PreferencesWindow:`visible-page].
* @param name the name of the page to make visible
*/
set_visible_page_name(name: string): void;
// Inherited properties
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// 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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace PropertyAnimationTarget {
// Constructor properties interface
interface ConstructorProps extends AnimationTarget.ConstructorProps {
object: GObject.Object;
pspec: GObject.ParamSpec;
}
}
/**
* An [class`AnimationTarget]` changing the value of a property of a
* [class`GObject`.Object] instance.
*/
class PropertyAnimationTarget extends AnimationTarget {
static $gtype: GObject.GType<PropertyAnimationTarget>;
// Properties
/**
* The object whose property will be animated.
*
* The `AdwPropertyAnimationTarget` instance does not hold a strong reference
* on the object; make sure the object is kept alive throughout the target's
* lifetime.
*/
get object(): GObject.Object;
/**
* The `GParamSpec` of the property to be animated.
*/
get pspec(): GObject.ParamSpec;
// Constructors
constructor(properties?: Partial<PropertyAnimationTarget.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](object: GObject.Object, property_name: string): PropertyAnimationTarget;
static new_for_pspec(object: GObject.Object, pspec: GObject.ParamSpec): PropertyAnimationTarget;
// Methods
/**
* Gets the object animated by `self`.
*
* The `AdwPropertyAnimationTarget` instance does not hold a strong reference on
* the object; make sure the object is kept alive throughout the target's
* lifetime.
* @returns the animated object
*/
get_object<T = GObject.Object>(): T;
/**
* Gets the `GParamSpec` of the property animated by `self`.
* @returns the animated property's `GParamSpec`
*/
get_pspec(): GObject.ParamSpec;
}
namespace SpinRow {
// Signal callback interfaces
interface Input {
(new_value: number): number;
}
interface Output {
(): boolean;
}
interface Wrapped {
(): void;
}
// Constructor properties interface
interface ConstructorProps
extends ActionRow.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Actionable.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Editable.ConstructorProps {
adjustment: Gtk.Adjustment;
climb_rate: number;
climbRate: number;
digits: number;
numeric: boolean;
snap_to_ticks: boolean;
snapToTicks: boolean;
update_policy: Gtk.SpinButtonUpdatePolicy;
updatePolicy: Gtk.SpinButtonUpdatePolicy;
value: number;
wrap: boolean;
}
}
/**
* An [class`ActionRow]` with an embedded spin button.
*
* <picture>
* <source srcset="spin-row-dark.png" media="(prefers-color-scheme: dark)">
* <img src="spin-row.png" alt="spin-row">
* </picture>
*
* Example of an `AdwSpinRow` UI definition:
*
* ```xml
* <object class="AdwSpinRow">
* <property name="title" translatable="yes">Spin Row</property>
* <property name="adjustment">
* <object class="GtkAdjustment">
* <property name="lower">0</property>
* <property name="upper">100</property>
* <property name="value">50</property>
* <property name="page-increment">10</property>
* <property name="step-increment">1</property>
* </object>
* </property>
* </object>
* ```
*
* See [class`Gtk`.SpinButton] for details.
*
* ## CSS nodes
*
* `AdwSpinRow` has the same structure as [class`ActionRow]`, as well as the
* `.spin` style class on the main node.
*
* ## Accessibility
*
* `AdwSpinRow` uses an internal `GtkSpinButton` with the
* `GTK_ACCESSIBLE_ROLE_SPIN_BUTTON` role.
*/
class SpinRow
extends ActionRow
implements Gtk.Accessible, Gtk.Actionable, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Editable
{
static $gtype: GObject.GType<SpinRow>;
// Properties
/**
* The adjustment that holds the value of the spin row.
*/
get adjustment(): Gtk.Adjustment;
set adjustment(val: Gtk.Adjustment);
/**
* The acceleration rate when you hold down a button or key.
*/
get climb_rate(): number;
set climb_rate(val: number);
/**
* The acceleration rate when you hold down a button or key.
*/
get climbRate(): number;
set climbRate(val: number);
/**
* The number of decimal places to display.
*/
get digits(): number;
set digits(val: number);
/**
* Whether non-numeric characters should be ignored.
*/
get numeric(): boolean;
set numeric(val: boolean);
/**
* Whether invalid values are snapped to the nearest step increment.
*/
get snap_to_ticks(): boolean;
set snap_to_ticks(val: boolean);
/**
* Whether invalid values are snapped to the nearest step increment.
*/
get snapToTicks(): boolean;
set snapToTicks(val: boolean);
/**
* The policy for updating the spin row.
*
* The options are always, or only when the value is invalid.
*/
get update_policy(): Gtk.SpinButtonUpdatePolicy;
set update_policy(val: Gtk.SpinButtonUpdatePolicy);
/**
* The policy for updating the spin row.
*
* The options are always, or only when the value is invalid.
*/
get updatePolicy(): Gtk.SpinButtonUpdatePolicy;
set updatePolicy(val: Gtk.SpinButtonUpdatePolicy);
/**
* The current value.
*/
get value(): number;
set value(val: number);
/**
* Whether the spin row should wrap upon reaching its limits.
*/
get wrap(): boolean;
set wrap(val: boolean);
// Constructors
constructor(properties?: Partial<SpinRow.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](adjustment: Gtk.Adjustment | null, climb_rate: number, digits: number): SpinRow;
// Conflicted with Adw.ActionRow.new
static ['new'](...args: never[]): any;
static new_with_range(min: number, max: number, step: number): SpinRow;
// 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: 'input', callback: (_source: this, new_value: number) => number): number;
connect_after(signal: 'input', callback: (_source: this, new_value: number) => number): number;
emit(signal: 'input', new_value: number): void;
connect(signal: 'output', callback: (_source: this) => boolean): number;
connect_after(signal: 'output', callback: (_source: this) => boolean): number;
emit(signal: 'output'): void;
connect(signal: 'wrapped', callback: (_source: this) => void): number;
connect_after(signal: 'wrapped', callback: (_source: this) => void): number;
emit(signal: 'wrapped'): void;
// Methods
/**
* Changes the properties of an existing spin row.
*
* The adjustment, climb rate, and number of decimal places are updated
* accordingly.
* @param adjustment the adjustment that this spin row should use
* @param climb_rate the new climb rate
* @param digits the number of decimal places to display
*/
configure(adjustment: Gtk.Adjustment | null, climb_rate: number, digits: number): void;
/**
* Gets the adjustment that holds the value for the spin row.
* @returns the adjustment that holds the spin row's value
*/
get_adjustment(): Gtk.Adjustment;
/**
* Gets the acceleration rate when you hold down a button or key.
* @returns the acceleration rate when you hold down a button or key
*/
get_climb_rate(): number;
/**
* Gets the number of decimal places to display.
* @returns the number of decimal places to display
*/
get_digits(): number;
/**
* Gets whether non-numeric characters should be ignored.
* @returns whether non-numeric characters should be ignored.
*/
get_numeric(): boolean;
/**
* Gets whether invalid values are snapped to nearest step increment.
* @returns whether invalid values are snapped to the nearest step increment
*/
get_snap_to_ticks(): boolean;
/**
* Gets the policy for updating the spin row.
* @returns the policy for updating the spin row
*/
get_update_policy(): Gtk.SpinButtonUpdatePolicy;
/**
* Gets the current value.
* @returns the current value
*/
get_value(): number;
/**
* Gets whether the spin row should wrap upon reaching its limits.
* @returns whether the spin row should wrap upon reaching its limits
*/
get_wrap(): boolean;
/**
* Sets the adjustment that holds the value for the spin row.
* @param adjustment an adjustment
*/
set_adjustment(adjustment?: Gtk.Adjustment | null): void;
/**
* Sets the acceleration rate when you hold down a button or key.
* @param climb_rate the acceleration rate when you hold down a button or key
*/
set_climb_rate(climb_rate: number): void;
/**
* Sets the number of decimal places to display.
* @param digits the number of decimal places to display
*/
set_digits(digits: number): void;
/**
* Sets whether non-numeric characters should be ignored.
* @param numeric whether non-numeric characters should be ignored
*/
set_numeric(numeric: boolean): void;
/**
* Sets the minimum and maximum allowable values for `self`.
*
* If the current value is outside this range, it will be adjusted
* to fit within the range, otherwise it will remain unchanged.
* @param min minimum allowable value
* @param max maximum allowable value
*/
set_range(min: number, max: number): void;
/**
* Sets whether invalid values are snapped to the nearest step increment.
* @param snap_to_ticks whether invalid values are snapped to the nearest step increment
*/
set_snap_to_ticks(snap_to_ticks: boolean): void;
/**
* Sets the policy for updating the spin row.
*
* The options are always, or only when the value is invalid.
* @param policy the policy for updating the spin row
*/
set_update_policy(policy: Gtk.SpinButtonUpdatePolicy | null): void;
/**
* Sets the current value.
* @param value a new value
*/
set_value(value: number): void;
/**
* Sets whether the spin row should wrap upon reaching its limits.
* @param wrap whether the spin row should wrap upon reaching its limits
*/
set_wrap(wrap: boolean): void;
/**
* Manually force an update of the spin row.
*/
update(): void;
// Inherited properties
/**
* The current position of the insertion cursor in chars.
*/
get cursor_position(): number;
/**
* The current position of the insertion cursor in chars.
*/
get cursorPosition(): number;
/**
* Whether the entry contents can be edited.
*/
get editable(): boolean;
set editable(val: boolean);
/**
* If undo/redo should be enabled for the editable.
*/
get enable_undo(): boolean;
set enable_undo(val: boolean);
/**
* If undo/redo should be enabled for the editable.
*/
get enableUndo(): boolean;
set enableUndo(val: boolean);
/**
* The desired maximum width of the entry, in characters.
*/
get max_width_chars(): number;
set max_width_chars(val: number);
/**
* The desired maximum width of the entry, in characters.
*/
get maxWidthChars(): number;
set maxWidthChars(val: number);
/**
* The position of the opposite end of the selection from the cursor in chars.
*/
get selection_bound(): number;
/**
* The position of the opposite end of the selection from the cursor in chars.
*/
get selectionBound(): number;
/**
* The contents of the entry.
*/
get text(): string;
set text(val: string);
/**
* Number of characters to leave space for in the entry.
*/
get width_chars(): number;
set width_chars(val: number);
/**
* Number of characters to leave space for in the entry.
*/
get widthChars(): number;
set widthChars(val: number);
/**
* The horizontal alignment, from 0 (left) to 1 (right).
*
* Reversed for RTL layouts.
*/
get xalign(): number;
set xalign(val: number);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// Inherited methods
/**
* Retrieves the accessible platform state from the editable delegate.
*
* This is an helper function to retrieve the accessible state for
* `GtkEditable` interface implementations using a delegate pattern.
*
* You should call this function in your editable widget implementation
* of the [vfunc`Gtk`.Accessible.get_platform_state] virtual function, for
* instance:
*
* ```c
* static void
* accessible_interface_init (GtkAccessibleInterface *iface)
* {
* iface->get_platform_state = your_editable_get_accessible_platform_state;
* }
*
* static gboolean
* your_editable_get_accessible_platform_state (GtkAccessible *accessible,
* GtkAccessiblePlatformState state)
* {
* return gtk_editable_delegate_get_accessible_platform_state (GTK_EDITABLE (accessible), state);
* }
* ```
*
* Note that the widget which is the delegate *must* be a direct child of
* this widget, otherwise your implementation of [vfunc`Gtk`.Accessible.get_platform_state]
* might not even be called, as the platform change will originate from
* the parent of the delegate, and, as a result, will not work properly.
*
* So, if you can't ensure the direct child condition, you should give the
* delegate the %GTK_ACCESSIBLE_ROLE_TEXT_BOX role, or you can
* change your tree to allow this function to work.
* @param state what kind of accessible state to retrieve
* @returns the accessible platform state of the delegate
*/
delegate_get_accessible_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Deletes the currently selected text of the editable.
*
* This call doesnt do anything if there is no selected text.
*/
delete_selection(): void;
/**
* Deletes a sequence of characters.
*
* The characters that are deleted are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is
* negative, then the characters deleted are those from `start_pos` to
* the end of the text.
*
* Note that the positions are specified in characters, not bytes.
* @param start_pos start position
* @param end_pos end position
*/
delete_text(start_pos: number, end_pos: number): void;
/**
* Undoes the setup done by [method`Gtk`.Editable.init_delegate].
*
* This is a helper function that should be called from dispose,
* before removing the delegate object.
*/
finish_delegate(): void;
/**
* Gets the alignment of the editable.
* @returns the alignment
*/
get_alignment(): number;
/**
* Retrieves a sequence of characters.
*
* The characters that are retrieved are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is negative,
* then the characters retrieved are those characters from `start_pos` to
* the end of the text.
*
* Note that positions are specified in characters, not bytes.
* @param start_pos start of text
* @param end_pos end of text
* @returns a pointer to the contents of the widget as a string. This string is allocated by the `GtkEditable` implementation and should be freed by the caller.
*/
get_chars(start_pos: number, end_pos: number): string;
/**
* Gets the `GtkEditable` that `editable` is delegating its
* implementation to.
*
* Typically, the delegate is a [class`Gtk`.Text] widget.
* @returns the delegate `GtkEditable`
*/
get_delegate(): Gtk.Editable | null;
/**
* Retrieves whether `editable` is editable.
* @returns %TRUE if @editable is editable.
*/
get_editable(): boolean;
/**
* Gets if undo/redo actions are enabled for `editable`
* @returns %TRUE if undo is enabled
*/
get_enable_undo(): boolean;
/**
* Retrieves the desired maximum width of `editable,` in characters.
* @returns the maximum width of the entry, in characters
*/
get_max_width_chars(): number;
/**
* Retrieves the current position of the cursor relative
* to the start of the content of the editable.
*
* Note that this position is in characters, not in bytes.
* @returns the cursor position
*/
get_position(): number;
/**
* Retrieves the selection bound of the editable.
*
* `start_pos` will be filled with the start of the selection and
* `end_pos` with end. If no text was selected both will be identical
* and %FALSE will be returned.
*
* Note that positions are specified in characters, not bytes.
* @returns %TRUE if there is a non-empty selection, %FALSE otherwise
*/
get_selection_bounds(): [boolean, number, number];
/**
* Retrieves the contents of `editable`.
*
* The returned string is owned by GTK and must not be modified or freed.
* @returns a pointer to the contents of the editable
*/
get_text(): string;
/**
* Gets the number of characters of space reserved
* for the contents of the editable.
* @returns number of chars to request space for, or negative if unset
*/
get_width_chars(): number;
/**
* Sets up a delegate for `GtkEditable`.
*
* This is assuming that the get_delegate vfunc in the `GtkEditable`
* interface has been set up for the `editable'`s type.
*
* This is a helper function that should be called in instance init,
* after creating the delegate object.
*/
init_delegate(): void;
/**
* Inserts `length` bytes of `text` into the contents of the
* widget, at position `position`.
*
* Note that the position is in characters, not in bytes.
* The function updates `position` to point after the newly
* inserted text.
* @param text the text to insert
* @param length the length of the text in bytes, or -1
* @param position location of the position text will be inserted at
*/
insert_text(text: string, length: number, position: number): number;
/**
* Selects a region of text.
*
* The characters that are selected are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is
* negative, then the characters selected are those characters from
* `start_pos` to the end of the text.
*
* Note that positions are specified in characters, not bytes.
* @param start_pos start of region
* @param end_pos end of region
*/
select_region(start_pos: number, end_pos: number): void;
/**
* Sets the alignment for the contents of the editable.
*
* This controls the horizontal positioning of the contents when
* the displayed text is shorter than the width of the editable.
* @param xalign The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts
*/
set_alignment(xalign: number): void;
/**
* Determines if the user can edit the text in the editable widget.
* @param is_editable %TRUE if the user is allowed to edit the text in the widget
*/
set_editable(is_editable: boolean): void;
/**
* If enabled, changes to `editable` will be saved for undo/redo
* actions.
*
* This results in an additional copy of text changes and are not
* stored in secure memory. As such, undo is forcefully disabled
* when [property`Gtk`.Text:visibility] is set to %FALSE.
* @param enable_undo if undo/redo should be enabled
*/
set_enable_undo(enable_undo: boolean): void;
/**
* Sets the desired maximum width in characters of `editable`.
* @param n_chars the new desired maximum width, in characters
*/
set_max_width_chars(n_chars: number): void;
/**
* Sets the cursor position in the editable to the given value.
*
* The cursor is displayed before the character with the given (base 0)
* index in the contents of the editable. The value must be less than
* or equal to the number of characters in the editable. A value of -1
* indicates that the position should be set after the last character
* of the editable. Note that `position` is in characters, not in bytes.
* @param position the position of the cursor
*/
set_position(position: number): void;
/**
* Sets the text in the editable to the given value.
*
* This is replacing the current contents.
* @param text the text to set
*/
set_text(text: string): void;
/**
* Changes the size request of the editable to be about the
* right size for `n_chars` characters.
*
* Note that it changes the size request, the size can still
* be affected by how you pack the widget into containers.
* If `n_chars` is -1, the size reverts to the default size.
* @param n_chars width in chars
*/
set_width_chars(n_chars: number): void;
vfunc_changed(): void;
/**
* Deletes a sequence of characters.
*
* The characters that are deleted are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is
* negative, then the characters deleted are those from `start_pos` to
* the end of the text.
*
* Note that the positions are specified in characters, not bytes.
* @param start_pos start position
* @param end_pos end position
*/
vfunc_delete_text(start_pos: number, end_pos: number): void;
/**
* Deletes a sequence of characters.
*
* The characters that are deleted are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is
* negative, then the characters deleted are those from `start_pos` to
* the end of the text.
*
* Note that the positions are specified in characters, not bytes.
* @param start_pos start position
* @param end_pos end position
*/
vfunc_do_delete_text(start_pos: number, end_pos: number): void;
/**
* Inserts `length` bytes of `text` into the contents of the
* widget, at position `position`.
*
* Note that the position is in characters, not in bytes.
* The function updates `position` to point after the newly
* inserted text.
* @param text the text to insert
* @param length the length of the text in bytes, or -1
* @param position location of the position text will be inserted at
*/
vfunc_do_insert_text(text: string, length: number, position: number): number;
/**
* Gets the `GtkEditable` that `editable` is delegating its
* implementation to.
*
* Typically, the delegate is a [class`Gtk`.Text] widget.
*/
vfunc_get_delegate(): Gtk.Editable | null;
/**
* Retrieves the selection bound of the editable.
*
* `start_pos` will be filled with the start of the selection and
* `end_pos` with end. If no text was selected both will be identical
* and %FALSE will be returned.
*
* Note that positions are specified in characters, not bytes.
*/
vfunc_get_selection_bounds(): [boolean, number, number];
/**
* Retrieves the contents of `editable`.
*
* The returned string is owned by GTK and must not be modified or freed.
*/
vfunc_get_text(): string;
/**
* Inserts `length` bytes of `text` into the contents of the
* widget, at position `position`.
*
* Note that the position is in characters, not in bytes.
* The function updates `position` to point after the newly
* inserted text.
* @param text the text to insert
* @param length the length of the text in bytes, or -1
* @param position location of the position text will be inserted at
*/
vfunc_insert_text(text: string, length: number, position: number): number;
/**
* Selects a region of text.
*
* The characters that are selected are those characters at positions
* from `start_pos` up to, but not including `end_pos`. If `end_pos` is
* negative, then the characters selected are those characters from
* `start_pos` to the end of the text.
*
* Note that positions are specified in characters, not bytes.
* @param start_pos start of region
* @param end_pos end of region
*/
vfunc_set_selection_bounds(start_pos: number, end_pos: number): 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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
// Conflicted with Adw.ActionRow.activate
activate(...args: never[]): any;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace Spinner {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {}
}
/**
* A widget showing a loading spinner.
*
* <picture>
* <source srcset="spinner-dark.png" media="(prefers-color-scheme: dark)">
* <img src="spinner.png" alt="spinner">
* </picture>
*
* The size of the spinner depends on the available size, never smaller than
* 16×16 pixels and never larger than 64×64 pixels.
*
* Use the [property`Gtk`.Widget:halign] and [property`Gtk`.Widget:valign]
* properties in combination with [property`Gtk`.Widget:width-request] and
* [property`Gtk`.Widget:height-request] for fine sizing control.
*
* For example, the following snippet shows the spinner at 48×48 pixels:
*
* ```xml
* <object class="AdwSpinner">
* <property name="halign">center</property>
* <property name="valign">center</property>
* <property name="width-request">48</property>
* <property name="height-request">48</property>
* </object>
* ```
*
* See [class`SpinnerPaintable]` for cases where using a widget is impractical or
* impossible, such as [property`StatusPage:`paintable].
*
* ## CSS nodes
*
* `AdwSpinner` has a single node with the name `image` and the style class
* `.spinner`.
*/
class Spinner extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<Spinner>;
// Constructors
constructor(properties?: Partial<Spinner.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): Spinner;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 SpinnerPaintable {
// Constructor properties interface
interface ConstructorProps
extends GObject.Object.ConstructorProps,
Gdk.Paintable.ConstructorProps,
Gtk.SymbolicPaintable.ConstructorProps {
widget: Gtk.Widget;
}
}
/**
* A paintable showing a loading spinner.
*
* <picture>
* <source srcset="spinner-dark.png" media="(prefers-color-scheme: dark)">
* <img src="spinner.png" alt="spinner">
* </picture>
*
* `AdwSpinnerPaintable` size varies depending on the available space, but is
* capped at 64×64 pixels.
*
* To be able to animate, `AdwSpinnerPaintable` needs a widget. It will be
* animated according to that widget's frame clock, and only if that widget is
* mapped. Ideally it should be the same widget the paintable is displayed in,
* but that's not a requirement.
*
* Most applications should be using [class`Spinner]` instead.
* `AdwSpinnerPaintable` is provided for the cases where using a widget is
* impractical or impossible, such as [property`StatusPage:`paintable]:
*
* ```xml
* <object class="AdwStatusPage" id="status_page">
* <property name="paintable">
* <object class="AdwSpinnerPaintable">
* <property name="widget">status_page</property>
* </object>
* </property>
* <!-- ... -->
* </object>
* ```
*/
class SpinnerPaintable extends GObject.Object implements Gdk.Paintable, Gtk.SymbolicPaintable {
static $gtype: GObject.GType<SpinnerPaintable>;
// Properties
/**
* The widget the spinner uses for frame clock.
*/
get widget(): Gtk.Widget;
set widget(val: Gtk.Widget);
// Constructors
constructor(properties?: Partial<SpinnerPaintable.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](widget?: Gtk.Widget | null): SpinnerPaintable;
// Methods
/**
* Gets the widget used for frame clock.
* @returns the widget
*/
get_widget(): Gtk.Widget | null;
/**
* Sets the widget used for frame clock.
* @param widget the widget to use for frame clock
*/
set_widget(widget?: Gtk.Widget | null): void;
// Inherited methods
/**
* Compute a concrete size for the `GdkPaintable`.
*
* Applies the sizing algorithm outlined in the
* [CSS Image spec](https://drafts.csswg.org/css-images-3/#default-sizing)
* to the given `paintable`. See that link for more details.
*
* It is not necessary to call this function when both `specified_width`
* and `specified_height` are known, but it is useful to call this
* function in GtkWidget:measure implementations to compute the
* other dimension when only one dimension is given.
* @param specified_width the width @paintable could be drawn into or 0.0 if unknown
* @param specified_height the height @paintable could be drawn into or 0.0 if unknown
* @param default_width the width @paintable would be drawn into if no other constraints were given
* @param default_height the height @paintable would be drawn into if no other constraints were given
*/
compute_concrete_size(
specified_width: number,
specified_height: number,
default_width: number,
default_height: number,
): [number, number];
/**
* Gets an immutable paintable for the current contents displayed by `paintable`.
*
* This is useful when you want to retain the current state of an animation,
* for example to take a screenshot of a running animation.
*
* If the `paintable` is already immutable, it will return itself.
* @returns An immutable paintable for the current contents of @paintable
*/
get_current_image(): Gdk.Paintable;
/**
* Get flags for the paintable.
*
* This is oftentimes useful for optimizations.
*
* See [flags`Gdk`.PaintableFlags] for the flags and what they mean.
* @returns The `GdkPaintableFlags` for this paintable
*/
get_flags(): Gdk.PaintableFlags;
/**
* Gets the preferred aspect ratio the `paintable` would like to be displayed at.
*
* The aspect ratio is the width divided by the height, so a value of 0.5
* means that the `paintable` prefers to be displayed twice as high as it
* is wide. Consumers of this interface can use this to preserve aspect
* ratio when displaying the paintable.
*
* This is a purely informational value and does not in any way limit the
* values that may be passed to [method`Gdk`.Paintable.snapshot].
*
* Usually when a `paintable` returns nonzero values from
* [method`Gdk`.Paintable.get_intrinsic_width] and
* [method`Gdk`.Paintable.get_intrinsic_height] the aspect ratio
* should conform to those values, though that is not required.
*
* If the `paintable` does not have a preferred aspect ratio,
* it returns 0. Negative values are never returned.
* @returns the intrinsic aspect ratio of @paintable or 0 if none.
*/
get_intrinsic_aspect_ratio(): number;
/**
* Gets the preferred height the `paintable` would like to be displayed at.
*
* Consumers of this interface can use this to reserve enough space to draw
* the paintable.
*
* This is a purely informational value and does not in any way limit the
* values that may be passed to [method`Gdk`.Paintable.snapshot].
*
* If the `paintable` does not have a preferred height, it returns 0.
* Negative values are never returned.
* @returns the intrinsic height of @paintable or 0 if none.
*/
get_intrinsic_height(): number;
/**
* Gets the preferred width the `paintable` would like to be displayed at.
*
* Consumers of this interface can use this to reserve enough space to draw
* the paintable.
*
* This is a purely informational value and does not in any way limit the
* values that may be passed to [method`Gdk`.Paintable.snapshot].
*
* If the `paintable` does not have a preferred width, it returns 0.
* Negative values are never returned.
* @returns the intrinsic width of @paintable or 0 if none.
*/
get_intrinsic_width(): number;
/**
* Called by implementations of `GdkPaintable` to invalidate their contents.
*
* Unless the contents are invalidated, implementations must guarantee that
* multiple calls of [method`Gdk`.Paintable.snapshot] produce the same output.
*
* This function will emit the [signal`Gdk`.Paintable::invalidate-contents]
* signal.
*
* If a `paintable` reports the %GDK_PAINTABLE_STATIC_CONTENTS flag,
* it must not call this function.
*/
invalidate_contents(): void;
/**
* Called by implementations of `GdkPaintable` to invalidate their size.
*
* As long as the size is not invalidated, `paintable` must return the same
* values for its intrinsic width, height and aspect ratio.
*
* This function will emit the [signal`Gdk`.Paintable::invalidate-size]
* signal.
*
* If a `paintable` reports the %GDK_PAINTABLE_STATIC_SIZE flag,
* it must not call this function.
*/
invalidate_size(): void;
/**
* Snapshots the given paintable with the given `width` and `height`.
*
* The paintable is drawn at the current (0,0) offset of the `snapshot`.
* If `width` and `height` are not larger than zero, this function will
* do nothing.
* @param snapshot a `GdkSnapshot` to snapshot to
* @param width width to snapshot in
* @param height height to snapshot in
*/
snapshot(snapshot: Gdk.Snapshot, width: number, height: number): void;
/**
* Gets an immutable paintable for the current contents displayed by `paintable`.
*
* This is useful when you want to retain the current state of an animation,
* for example to take a screenshot of a running animation.
*
* If the `paintable` is already immutable, it will return itself.
*/
vfunc_get_current_image(): Gdk.Paintable;
/**
* Get flags for the paintable.
*
* This is oftentimes useful for optimizations.
*
* See [flags`Gdk`.PaintableFlags] for the flags and what they mean.
*/
vfunc_get_flags(): Gdk.PaintableFlags;
/**
* Gets the preferred aspect ratio the `paintable` would like to be displayed at.
*
* The aspect ratio is the width divided by the height, so a value of 0.5
* means that the `paintable` prefers to be displayed twice as high as it
* is wide. Consumers of this interface can use this to preserve aspect
* ratio when displaying the paintable.
*
* This is a purely informational value and does not in any way limit the
* values that may be passed to [method`Gdk`.Paintable.snapshot].
*
* Usually when a `paintable` returns nonzero values from
* [method`Gdk`.Paintable.get_intrinsic_width] and
* [method`Gdk`.Paintable.get_intrinsic_height] the aspect ratio
* should conform to those values, though that is not required.
*
* If the `paintable` does not have a preferred aspect ratio,
* it returns 0. Negative values are never returned.
*/
vfunc_get_intrinsic_aspect_ratio(): number;
/**
* Gets the preferred height the `paintable` would like to be displayed at.
*
* Consumers of this interface can use this to reserve enough space to draw
* the paintable.
*
* This is a purely informational value and does not in any way limit the
* values that may be passed to [method`Gdk`.Paintable.snapshot].
*
* If the `paintable` does not have a preferred height, it returns 0.
* Negative values are never returned.
*/
vfunc_get_intrinsic_height(): number;
/**
* Gets the preferred width the `paintable` would like to be displayed at.
*
* Consumers of this interface can use this to reserve enough space to draw
* the paintable.
*
* This is a purely informational value and does not in any way limit the
* values that may be passed to [method`Gdk`.Paintable.snapshot].
*
* If the `paintable` does not have a preferred width, it returns 0.
* Negative values are never returned.
*/
vfunc_get_intrinsic_width(): number;
/**
* Snapshots the given paintable with the given `width` and `height`.
*
* The paintable is drawn at the current (0,0) offset of the `snapshot`.
* If `width` and `height` are not larger than zero, this function will
* do nothing.
* @param snapshot a `GdkSnapshot` to snapshot to
* @param width width to snapshot in
* @param height height to snapshot in
*/
vfunc_snapshot(snapshot: Gdk.Snapshot, width: number, height: number): void;
/**
* Snapshots the paintable with the given colors.
*
* If less than 4 colors are provided, GTK will pad the array with default
* colors.
* @param snapshot a `GdkSnapshot` to snapshot to
* @param width width to snapshot in
* @param height height to snapshot in
* @param colors a pointer to an array of colors
*/
snapshot_symbolic(snapshot: Gdk.Snapshot, width: number, height: number, colors: Gdk.RGBA[]): void;
/**
* Snapshots the paintable with the given colors.
*
* If less than 4 colors are provided, GTK will pad the array with default
* colors.
* @param snapshot a `GdkSnapshot` to snapshot to
* @param width width to snapshot in
* @param height height to snapshot in
* @param colors a pointer to an array of colors
*/
vfunc_snapshot_symbolic(snapshot: Gdk.Snapshot, width: number, height: number, colors: Gdk.RGBA[]): 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 SplitButton {
// Signal callback interfaces
interface Activate {
(): void;
}
interface Clicked {
(): void;
}
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Actionable.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
can_shrink: boolean;
canShrink: boolean;
child: Gtk.Widget;
direction: Gtk.ArrowType;
dropdown_tooltip: string;
dropdownTooltip: string;
icon_name: string;
iconName: string;
label: string;
menu_model: Gio.MenuModel;
menuModel: Gio.MenuModel;
popover: Gtk.Popover;
use_underline: boolean;
useUnderline: boolean;
}
}
/**
* A combined button and dropdown widget.
*
* <picture>
* <source srcset="split-button-dark.png" media="(prefers-color-scheme: dark)">
* <img src="split-button.png" alt="split-button">
* </picture>
*
* `AdwSplitButton` is typically used to present a set of actions in a menu,
* but allow access to one of them with a single click.
*
* The API is very similar to [class`Gtk`.Button] and [class`Gtk`.MenuButton], see
* their documentation for details.
*
* ## CSS nodes
*
* ```
* splitbutton[.image-button][.text-button]
* ├── button
* │ ╰── <content>
* ├── separator
* ╰── menubutton
* ╰── button.toggle
* ╰── arrow
* ```
*
* `AdwSplitButton`'s CSS node is called `splitbutton`. It contains the css
* nodes: `button`, `separator`, `menubutton`. See [class`Gtk`.MenuButton]
* documentation for the `menubutton` contents.
*
* The main CSS node will contain the `.image-button` or `.text-button` style
* classes matching the button contents. The nested button nodes will never
* contain them.
*
* ## Style classes
*
* `AdwSplitButton` can use some of the same style classes as [class`Gtk`.Button]:
*
* - [`.suggested-action`](style-classes.html#suggested-action)
* - [`.destructive-action`](style-classes.html#destructive-action)
* - [`.flat`](style-classes.html#flat)
* - [`.raised`](style-classes.html#raised)
*
* Other style classes, like `.pill`, cannot be used.
*
* ## Accessibility
*
* `AdwSplitButton` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.
*/
class SplitButton
extends Gtk.Widget
implements Gtk.Accessible, Gtk.Actionable, Gtk.Buildable, Gtk.ConstraintTarget
{
static $gtype: GObject.GType<SplitButton>;
// Properties
/**
* Whether the button can be smaller than the natural size of its contents.
*
* If set to `TRUE`, the label will ellipsize.
*
* See [property`Gtk`.Button:can-shrink] and
* [property`Gtk`.MenuButton:can-shrink].
*/
get can_shrink(): boolean;
set can_shrink(val: boolean);
/**
* Whether the button can be smaller than the natural size of its contents.
*
* If set to `TRUE`, the label will ellipsize.
*
* See [property`Gtk`.Button:can-shrink] and
* [property`Gtk`.MenuButton:can-shrink].
*/
get canShrink(): boolean;
set canShrink(val: boolean);
/**
* The child widget.
*
* Setting the child widget will set [property`SplitButton:`label] and
* [property`SplitButton:`icon-name] to `NULL`.
*/
get child(): Gtk.Widget;
set child(val: Gtk.Widget);
/**
* The direction in which the popup will be popped up.
*
* The dropdown arrow icon will point at the same direction.
*
* If the does not fit in the available space in the given direction, GTK will
* try its best to keep it inside the screen and fully visible.
*
* If you pass `GTK_ARROW_NONE`, it's equivalent to `GTK_ARROW_DOWN`.
*/
get direction(): Gtk.ArrowType;
set direction(val: Gtk.ArrowType);
/**
* The tooltip of the dropdown button.
*
* The tooltip can be marked up with the Pango text markup language.
*/
get dropdown_tooltip(): string;
set dropdown_tooltip(val: string);
/**
* The tooltip of the dropdown button.
*
* The tooltip can be marked up with the Pango text markup language.
*/
get dropdownTooltip(): string;
set dropdownTooltip(val: string);
/**
* The name of the icon used to automatically populate the button.
*
* Setting the icon name will set [property`SplitButton:`label] and
* [property`SplitButton:`child] to `NULL`.
*/
get icon_name(): string;
set icon_name(val: string);
/**
* The name of the icon used to automatically populate the button.
*
* Setting the icon name will set [property`SplitButton:`label] and
* [property`SplitButton:`child] to `NULL`.
*/
get iconName(): string;
set iconName(val: string);
/**
* The label for the button.
*
* Setting the label will set [property`SplitButton:`icon-name] and
* [property`SplitButton:`child] to `NULL`.
*/
get label(): string;
set label(val: string);
/**
* The `GMenuModel` from which the popup will be created.
*
* If the menu model is `NULL`, the dropdown is disabled.
*
* A [class`Gtk`.Popover] will be created from the menu model with
* [ctor`Gtk`.PopoverMenu.new_from_model]. Actions will be connected as
* documented for this function.
*
* If [property`SplitButton:`popover] is already set, it will be dissociated
* from the button, and the property is set to `NULL`.
*/
get menu_model(): Gio.MenuModel;
set menu_model(val: Gio.MenuModel);
/**
* The `GMenuModel` from which the popup will be created.
*
* If the menu model is `NULL`, the dropdown is disabled.
*
* A [class`Gtk`.Popover] will be created from the menu model with
* [ctor`Gtk`.PopoverMenu.new_from_model]. Actions will be connected as
* documented for this function.
*
* If [property`SplitButton:`popover] is already set, it will be dissociated
* from the button, and the property is set to `NULL`.
*/
get menuModel(): Gio.MenuModel;
set menuModel(val: Gio.MenuModel);
/**
* The `GtkPopover` that will be popped up when the dropdown is clicked.
*
* If the popover is `NULL`, the dropdown is disabled.
*
* If [property`SplitButton:`menu-model] is set, the menu model is dissociated
* from the button, and the property is set to `NULL`.
*/
get popover(): Gtk.Popover;
set popover(val: Gtk.Popover);
/**
* Whether an underline in the text indicates a mnemonic.
*
* See [property`SplitButton:`label].
*/
get use_underline(): boolean;
set use_underline(val: boolean);
/**
* Whether an underline in the text indicates a mnemonic.
*
* See [property`SplitButton:`label].
*/
get useUnderline(): boolean;
set useUnderline(val: boolean);
// Constructors
constructor(properties?: Partial<SplitButton.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): SplitButton;
// 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) => void): number;
connect_after(signal: 'activate', callback: (_source: this) => void): number;
emit(signal: 'activate'): void;
connect(signal: 'clicked', callback: (_source: this) => void): number;
connect_after(signal: 'clicked', callback: (_source: this) => void): number;
emit(signal: 'clicked'): void;
// Methods
/**
* gets whether the button can be smaller than the natural size of its contents.
* @returns whether the button can shrink
*/
get_can_shrink(): boolean;
/**
* Gets the child widget.
* @returns the child widget
*/
get_child(): Gtk.Widget | null;
/**
* Gets the direction in which the popup will be popped up.
* @returns the direction
*/
get_direction(): Gtk.ArrowType;
// Conflicted with Gtk.Widget.get_direction
get_direction(...args: never[]): any;
/**
* Gets the tooltip of the dropdown button of `self`.
* @returns the dropdown tooltip of @self
*/
get_dropdown_tooltip(): string;
/**
* Gets the name of the icon used to automatically populate the button.
* @returns the icon name
*/
get_icon_name(): string | null;
/**
* Gets the label for `self`.
* @returns the label for @self
*/
get_label(): string | null;
/**
* Gets the menu model from which the popup will be created.
* @returns the menu model
*/
get_menu_model(): Gio.MenuModel | null;
/**
* Gets the popover that will be popped up when the dropdown is clicked.
* @returns the popover
*/
get_popover(): Gtk.Popover | null;
/**
* Gets whether an underline in the text indicates a mnemonic.
* @returns whether an underline in the text indicates a mnemonic
*/
get_use_underline(): boolean;
/**
* Dismisses the menu.
*/
popdown(): void;
/**
* Pops up the menu.
*/
popup(): void;
/**
* Sets whether the button can be smaller than the natural size of its contents.
*
* If set to `TRUE`, the label will ellipsize.
*
* See [method`Gtk`.Button.set_can_shrink] and
* [method`Gtk`.MenuButton.set_can_shrink].
* @param can_shrink whether the button can shrink
*/
set_can_shrink(can_shrink: boolean): void;
/**
* Sets the child widget.
*
* Setting the child widget will set [property`SplitButton:`label] and
* [property`SplitButton:`icon-name] to `NULL`.
* @param child the new child widget
*/
set_child(child?: Gtk.Widget | null): void;
/**
* Sets the direction in which the popup will be popped up.
*
* The dropdown arrow icon will point at the same direction.
*
* If the does not fit in the available space in the given direction, GTK will
* try its best to keep it inside the screen and fully visible.
*
* If you pass `GTK_ARROW_NONE`, it's equivalent to `GTK_ARROW_DOWN`.
* @param direction the direction
*/
set_direction(direction: Gtk.ArrowType | null): void;
// Conflicted with Gtk.Widget.set_direction
set_direction(...args: never[]): any;
/**
* Sets the tooltip of the dropdown button of `self`.
*
* The tooltip can be marked up with the Pango text markup language.
* @param tooltip the dropdown tooltip of @self
*/
set_dropdown_tooltip(tooltip: string): void;
/**
* Sets the name of the icon used to automatically populate the button.
*
* Setting the icon name will set [property`SplitButton:`label] and
* [property`SplitButton:`child] to `NULL`.
* @param icon_name the icon name to set
*/
set_icon_name(icon_name: string): void;
/**
* Sets the label for `self`.
*
* Setting the label will set [property`SplitButton:`icon-name] and
* [property`SplitButton:`child] to `NULL`.
* @param label the label to set
*/
set_label(label: string): void;
/**
* Sets the menu model from which the popup will be created.
*
* If the menu model is `NULL`, the dropdown is disabled.
*
* A [class`Gtk`.Popover] will be created from the menu model with
* [ctor`Gtk`.PopoverMenu.new_from_model]. Actions will be connected as
* documented for this function.
*
* If [property`SplitButton:`popover] is already set, it will be dissociated from
* the button, and the property is set to `NULL`.
* @param menu_model the menu model
*/
set_menu_model(menu_model?: Gio.MenuModel | null): void;
/**
* Sets the popover that will be popped up when the dropdown is clicked.
*
* If the popover is `NULL`, the dropdown is disabled.
*
* If [property`SplitButton:`menu-model] is set, the menu model is dissociated
* from the button, and the property is set to `NULL`.
* @param popover the popover
*/
set_popover(popover?: Gtk.Popover | null): void;
/**
* Sets whether an underline in the text indicates a mnemonic.
*
* See [property`SplitButton:`label].
* @param use_underline whether an underline in the text indicates a mnemonic
*/
set_use_underline(use_underline: boolean): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* The name of the action with which this widget should be associated.
*/
get action_name(): string;
set action_name(val: string);
/**
* The name of the action with which this widget should be associated.
*/
get actionName(): string;
set actionName(val: string);
/**
* The target value of the actionable widget's action.
*/
get action_target(): GLib.Variant;
set action_target(val: GLib.Variant);
/**
* The target value of the actionable widget's action.
*/
get actionTarget(): GLib.Variant;
set actionTarget(val: GLib.Variant);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the action name for `actionable`.
* @returns the action name
*/
get_action_name(): string | null;
/**
* Gets the current target value of `actionable`.
* @returns the current target value
*/
get_action_target_value(): GLib.Variant | null;
/**
* Specifies the name of the action with which this widget should be
* associated.
*
* If `action_name` is %NULL then the widget will be unassociated from
* any previous action.
*
* Usually this function is used when the widget is located (or will be
* located) within the hierarchy of a `GtkApplicationWindow`.
*
* Names are of the form “win.save” or “app.quit” for actions on the
* containing [class`ApplicationWindow]` or its associated [class`Application]`,
* respectively. This is the same form used for actions in the [class`Gio`.Menu]
* associated with the window.
* @param action_name an action name
*/
set_action_name(action_name?: string | null): void;
/**
* Sets the target value of an actionable widget.
*
* If `target_value` is %NULL then the target value is unset.
*
* The target value has two purposes. First, it is used as the parameter
* to activation of the action associated with the `GtkActionable` widget.
* Second, it is used to determine if the widget should be rendered as
* “active” — the widget is active if the state is equal to the given target.
*
* Consider the example of associating a set of buttons with a [iface`Gio`.Action]
* with string state in a typical “radio button” situation. Each button
* will be associated with the same action, but with a different target
* value for that action. Clicking on a particular button will activate
* the action with the target of that button, which will typically cause
* the actions state to change to that value. Since the actions state
* is now equal to the target value of the button, the button will now
* be rendered as active (and the other buttons, with different targets,
* rendered inactive).
* @param target_value a [struct@GLib.Variant] to set as the target value
*/
set_action_target_value(target_value?: GLib.Variant | null): void;
/**
* Sets the action-name and associated string target value of an
* actionable widget.
*
* `detailed_action_name` is a string in the format accepted by
* [func`Gio`.Action.parse_detailed_name].
* @param detailed_action_name the detailed action name
*/
set_detailed_action_name(detailed_action_name: string): void;
/**
* Gets the action name for `actionable`.
*/
vfunc_get_action_name(): string | null;
/**
* Gets the current target value of `actionable`.
*/
vfunc_get_action_target_value(): GLib.Variant | null;
/**
* Specifies the name of the action with which this widget should be
* associated.
*
* If `action_name` is %NULL then the widget will be unassociated from
* any previous action.
*
* Usually this function is used when the widget is located (or will be
* located) within the hierarchy of a `GtkApplicationWindow`.
*
* Names are of the form “win.save” or “app.quit” for actions on the
* containing [class`ApplicationWindow]` or its associated [class`Application]`,
* respectively. This is the same form used for actions in the [class`Gio`.Menu]
* associated with the window.
* @param action_name an action name
*/
vfunc_set_action_name(action_name?: string | null): void;
/**
* Sets the target value of an actionable widget.
*
* If `target_value` is %NULL then the target value is unset.
*
* The target value has two purposes. First, it is used as the parameter
* to activation of the action associated with the `GtkActionable` widget.
* Second, it is used to determine if the widget should be rendered as
* “active” — the widget is active if the state is equal to the given target.
*
* Consider the example of associating a set of buttons with a [iface`Gio`.Action]
* with string state in a typical “radio button” situation. Each button
* will be associated with the same action, but with a different target
* value for that action. Clicking on a particular button will activate
* the action with the target of that button, which will typically cause
* the actions state to change to that value. Since the actions state
* is now equal to the target value of the button, the button will now
* be rendered as active (and the other buttons, with different targets,
* rendered inactive).
* @param target_value a [struct@GLib.Variant] to set as the target value
*/
vfunc_set_action_target_value(target_value?: GLib.Variant | null): void;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace SpringAnimation {
// Constructor properties interface
interface ConstructorProps extends Animation.ConstructorProps {
clamp: boolean;
epsilon: number;
estimated_duration: number;
estimatedDuration: number;
initial_velocity: number;
initialVelocity: number;
spring_params: SpringParams;
springParams: SpringParams;
value_from: number;
valueFrom: number;
value_to: number;
valueTo: number;
velocity: number;
}
}
/**
* A spring-based [class`Animation]`.
*
* `AdwSpringAnimation` implements an animation driven by a physical model of a
* spring described by [struct`SpringParams]`, with a resting position in
* [property`SpringAnimation:`value-to], stretched to
* [property`SpringAnimation:`value-from].
*
* Since the animation is physically simulated, spring animations don't have a
* fixed duration. The animation will stop when the simulated spring comes to a
* rest - when the amplitude of the oscillations becomes smaller than
* [property`SpringAnimation:`epsilon], or immediately when it reaches
* [property`SpringAnimation:`value-to] if
* [property`SpringAnimation:`clamp] is set to `TRUE`. The estimated duration can
* be obtained with [property`SpringAnimation:`estimated-duration].
*
* Due to the nature of spring-driven motion the animation can overshoot
* [property`SpringAnimation:`value-to] before coming to a rest. Whether the
* animation will overshoot or not depends on the damping ratio of the spring.
* See [struct`SpringParams]` for more information about specific damping ratio
* values.
*
* If [property`SpringAnimation:`clamp] is `TRUE`, the animation will abruptly
* end as soon as it reaches the final value, preventing overshooting.
*
* Animations can have an initial velocity value, set via
* [property`SpringAnimation:`initial-velocity], which adjusts the curve without
* changing the duration. This makes spring animations useful for deceleration
* at the end of gestures.
*
* If the initial and final values are equal, and the initial velocity is not 0,
* the animation value will bounce and return to its resting position.
*/
class SpringAnimation extends Animation {
static $gtype: GObject.GType<SpringAnimation>;
// Properties
/**
* Whether the animation should be clamped.
*
* If set to `TRUE`, the animation will abruptly end as soon as it reaches the
* final value, preventing overshooting.
*
* It won't prevent overshooting [property`SpringAnimation:`value-from] if a
* relative negative [property`SpringAnimation:`initial-velocity] is set.
*/
get clamp(): boolean;
set clamp(val: boolean);
/**
* Precision of the spring.
*
* The level of precision used to determine when the animation has come to a
* rest, that is, when the amplitude of the oscillations becomes smaller than
* this value.
*
* If the epsilon value is too small, the animation will take a long time to
* stop after the animated value has stopped visibly changing.
*
* If the epsilon value is too large, the animation will end prematurely.
*
* The default value is 0.001.
*/
get epsilon(): number;
set epsilon(val: number);
/**
* Estimated duration of the animation, in milliseconds.
*
* Can be [const`DURATION_INFINITE]` if the spring damping is set to 0.
*/
get estimated_duration(): number;
/**
* Estimated duration of the animation, in milliseconds.
*
* Can be [const`DURATION_INFINITE]` if the spring damping is set to 0.
*/
get estimatedDuration(): number;
/**
* The initial velocity to start the animation with.
*
* Initial velocity affects only the animation curve, but not its duration.
*/
get initial_velocity(): number;
set initial_velocity(val: number);
/**
* The initial velocity to start the animation with.
*
* Initial velocity affects only the animation curve, but not its duration.
*/
get initialVelocity(): number;
set initialVelocity(val: number);
/**
* Physical parameters describing the spring.
*/
get spring_params(): SpringParams;
set spring_params(val: SpringParams);
/**
* Physical parameters describing the spring.
*/
get springParams(): SpringParams;
set springParams(val: SpringParams);
/**
* The value to animate from.
*
* The animation will start at this value and end at
* [property`SpringAnimation:`value-to].
*/
get value_from(): number;
set value_from(val: number);
/**
* The value to animate from.
*
* The animation will start at this value and end at
* [property`SpringAnimation:`value-to].
*/
get valueFrom(): number;
set valueFrom(val: number);
/**
* The value to animate to.
*
* The animation will start at [property`SpringAnimation:`value-from] and end
* at this value.
*/
get value_to(): number;
set value_to(val: number);
/**
* The value to animate to.
*
* The animation will start at [property`SpringAnimation:`value-from] and end
* at this value.
*/
get valueTo(): number;
set valueTo(val: number);
/**
* Current velocity of the animation.
*/
get velocity(): number;
// Constructors
constructor(properties?: Partial<SpringAnimation.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](
widget: Gtk.Widget,
from: number,
to: number,
spring_params: SpringParams,
target: AnimationTarget,
): SpringAnimation;
// Methods
/**
* Calculates the value `self` will have at `time`.
*
* The time starts at 0 and ends at
* [property`SpringAnimation:`estimated_duration].
*
* See also [method`SpringAnimation`.calculate_velocity].
* @param time elapsed time, in milliseconds
* @returns the value at @time
*/
calculate_value(time: number): number;
/**
* Calculates the velocity `self` will have at `time`.
*
* The time starts at 0 and ends at
* [property`SpringAnimation:`estimated_duration].
*
* See also [method`SpringAnimation`.calculate_value].
* @param time elapsed time, in milliseconds
* @returns the velocity at @time
*/
calculate_velocity(time: number): number;
/**
* Gets whether `self` should be clamped.
* @returns whether @self is clamped
*/
get_clamp(): boolean;
/**
* Gets the precision of the spring.
* @returns the epsilon value
*/
get_epsilon(): number;
/**
* Gets the estimated duration of `self,` in milliseconds.
*
* Can be [const`DURATION_INFINITE]` if the spring damping is set to 0.
* @returns the estimated duration
*/
get_estimated_duration(): number;
/**
* Gets the initial velocity of `self`.
* @returns the initial velocity
*/
get_initial_velocity(): number;
/**
* Gets the physical parameters of the spring of `self`.
* @returns the spring parameters
*/
get_spring_params(): SpringParams;
/**
* Gets the value `self` will animate from.
* @returns the value to animate from
*/
get_value_from(): number;
/**
* Gets the value `self` will animate to.
* @returns the value to animate to
*/
get_value_to(): number;
/**
* Gets the current velocity of `self`.
* @returns the current velocity
*/
get_velocity(): number;
/**
* Sets whether `self` should be clamped.
*
* If set to `TRUE`, the animation will abruptly end as soon as it reaches the
* final value, preventing overshooting.
*
* It won't prevent overshooting [property`SpringAnimation:`value-from] if a
* relative negative [property`SpringAnimation:`initial-velocity] is set.
* @param clamp the new value
*/
set_clamp(clamp: boolean): void;
/**
* Sets the precision of the spring.
*
* The level of precision used to determine when the animation has come to a
* rest, that is, when the amplitude of the oscillations becomes smaller than
* this value.
*
* If the epsilon value is too small, the animation will take a long time to
* stop after the animated value has stopped visibly changing.
*
* If the epsilon value is too large, the animation will end prematurely.
*
* The default value is 0.001.
* @param epsilon the new value
*/
set_epsilon(epsilon: number): void;
/**
* Sets the initial velocity of `self`.
*
* Initial velocity affects only the animation curve, but not its duration.
* @param velocity the initial velocity
*/
set_initial_velocity(velocity: number): void;
/**
* Sets the physical parameters of the spring of `self`.
* @param spring_params the new spring parameters
*/
set_spring_params(spring_params: SpringParams): void;
/**
* Sets the value `self` will animate from.
*
* The animation will start at this value and end at
* [property`SpringAnimation:`value-to].
* @param value the value to animate from
*/
set_value_from(value: number): void;
/**
* Sets the value `self` will animate to.
*
* The animation will start at [property`SpringAnimation:`value-from] and end at
* this value.
* @param value the value to animate to
*/
set_value_to(value: number): void;
}
namespace Squeezer {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Orientable.ConstructorProps {
allow_none: boolean;
allowNone: boolean;
homogeneous: boolean;
interpolate_size: boolean;
interpolateSize: boolean;
pages: Gtk.SelectionModel;
switch_threshold_policy: FoldThresholdPolicy;
switchThresholdPolicy: FoldThresholdPolicy;
transition_duration: number;
transitionDuration: number;
transition_running: boolean;
transitionRunning: boolean;
transition_type: SqueezerTransitionType;
transitionType: SqueezerTransitionType;
visible_child: Gtk.Widget;
visibleChild: Gtk.Widget;
xalign: number;
yalign: number;
}
}
/**
* A best fit container.
*
* <picture>
* <source srcset="squeezer-wide-dark.png" media="(prefers-color-scheme: dark)">
* <img src="squeezer-wide.png" alt="squeezer-wide">
* </picture>
* <picture>
* <source srcset="squeezer-narrow-dark.png" media="(prefers-color-scheme: dark)">
* <img src="squeezer-narrow.png" alt="squeezer-narrow">
* </picture>
*
* The `AdwSqueezer` widget is a container which only shows the first of its
* children that fits in the available size. It is convenient to offer different
* widgets to represent the same data with different levels of detail, making
* the widget seem to squeeze itself to fit in the available space.
*
* Transitions between children can be animated as fades. This can be controlled
* with [property`Squeezer:`transition-type].
*
* ## CSS nodes
*
* `AdwSqueezer` has a single CSS node with name `squeezer`.
*/
class Squeezer
extends Gtk.Widget
implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Orientable
{
static $gtype: GObject.GType<Squeezer>;
// Properties
/**
* Whether to allow squeezing beyond the last child's minimum size.
*
* If set to `TRUE`, the squeezer can shrink to the point where no child can
* be shown. This is functionally equivalent to appending a widget with 0×0
* minimum size.
*/
get allow_none(): boolean;
set allow_none(val: boolean);
/**
* Whether to allow squeezing beyond the last child's minimum size.
*
* If set to `TRUE`, the squeezer can shrink to the point where no child can
* be shown. This is functionally equivalent to appending a widget with 0×0
* minimum size.
*/
get allowNone(): boolean;
set allowNone(val: boolean);
/**
* Whether all children have the same size for the opposite orientation.
*
* For example, if a squeezer is horizontal and is homogeneous, it will
* request the same height for all its children. If it isn't, the squeezer may
* change size when a different child becomes visible.
*/
get homogeneous(): boolean;
set homogeneous(val: boolean);
/**
* Whether the squeezer interpolates its size when changing the visible child.
*
* If `TRUE`, the squeezer will interpolate its size between the one of the
* previous visible child and the one of the new visible child, according to
* the set transition duration and the orientation, e.g. if the squeezer is
* horizontal, it will interpolate the its height.
*/
get interpolate_size(): boolean;
set interpolate_size(val: boolean);
/**
* Whether the squeezer interpolates its size when changing the visible child.
*
* If `TRUE`, the squeezer will interpolate its size between the one of the
* previous visible child and the one of the new visible child, according to
* the set transition duration and the orientation, e.g. if the squeezer is
* horizontal, it will interpolate the its height.
*/
get interpolateSize(): boolean;
set interpolateSize(val: boolean);
/**
* A selection model with the squeezer's pages.
*
* This can be used to keep an up-to-date view. The model also implements
* [iface`Gtk`.SelectionModel] and can be used to track the visible page.
*/
get pages(): Gtk.SelectionModel;
/**
* The switch threshold policy.
*
* Determines when the squeezer will switch children.
*
* If set to `ADW_FOLD_THRESHOLD_POLICY_MINIMUM`, it will only switch when the
* visible child cannot fit anymore. With `ADW_FOLD_THRESHOLD_POLICY_NATURAL`,
* it will switch as soon as the visible child doesn't get their natural size.
*
* This can be useful if you have a long ellipsizing label and want to let it
* ellipsize instead of immediately switching.
*/
get switch_threshold_policy(): FoldThresholdPolicy;
set switch_threshold_policy(val: FoldThresholdPolicy);
/**
* The switch threshold policy.
*
* Determines when the squeezer will switch children.
*
* If set to `ADW_FOLD_THRESHOLD_POLICY_MINIMUM`, it will only switch when the
* visible child cannot fit anymore. With `ADW_FOLD_THRESHOLD_POLICY_NATURAL`,
* it will switch as soon as the visible child doesn't get their natural size.
*
* This can be useful if you have a long ellipsizing label and want to let it
* ellipsize instead of immediately switching.
*/
get switchThresholdPolicy(): FoldThresholdPolicy;
set switchThresholdPolicy(val: FoldThresholdPolicy);
/**
* The transition animation duration, in milliseconds.
*/
get transition_duration(): number;
set transition_duration(val: number);
/**
* The transition animation duration, in milliseconds.
*/
get transitionDuration(): number;
set transitionDuration(val: number);
/**
* Whether a transition is currently running.
*
* If a transition is impossible, the property value will be set to `TRUE` and
* then immediately to `FALSE`, so it's possible to rely on its notifications
* to know that a transition has happened.
*/
get transition_running(): boolean;
/**
* Whether a transition is currently running.
*
* If a transition is impossible, the property value will be set to `TRUE` and
* then immediately to `FALSE`, so it's possible to rely on its notifications
* to know that a transition has happened.
*/
get transitionRunning(): boolean;
/**
* The type of animation used for transitions between children.
*/
get transition_type(): SqueezerTransitionType;
set transition_type(val: SqueezerTransitionType);
/**
* The type of animation used for transitions between children.
*/
get transitionType(): SqueezerTransitionType;
set transitionType(val: SqueezerTransitionType);
/**
* The currently visible child.
*/
get visible_child(): Gtk.Widget;
/**
* The currently visible child.
*/
get visibleChild(): Gtk.Widget;
/**
* The horizontal alignment, from 0 (start) to 1 (end).
*
* This affects the children allocation during transitions, when they exceed
* the size of the squeezer.
*
* For example, 0.5 means the child will be centered, 0 means it will keep the
* start side aligned and overflow the end side, and 1 means the opposite.
*/
get xalign(): number;
set xalign(val: number);
/**
* The vertical alignment, from 0 (top) to 1 (bottom).
*
* This affects the children allocation during transitions, when they exceed
* the size of the squeezer.
*
* For example, 0.5 means the child will be centered, 0 means it will keep the
* top side aligned and overflow the bottom side, and 1 means the opposite.
*/
get yalign(): number;
set yalign(val: number);
// Constructors
constructor(properties?: Partial<Squeezer.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): Squeezer;
// Methods
/**
* Adds a child to `self`.
* @param child the widget to add
* @returns the [class@SqueezerPage] for @child
*/
add(child: Gtk.Widget): SqueezerPage;
/**
* Gets whether to allow squeezing beyond the last child's minimum size.
* @returns whether @self allows squeezing beyond the last child
*/
get_allow_none(): boolean;
/**
* Gets whether all children have the same size for the opposite orientation.
* @returns whether @self is homogeneous
*/
get_homogeneous(): boolean;
/**
* Gets whether `self` interpolates its size when changing the visible child.
* @returns whether the size is interpolated
*/
get_interpolate_size(): boolean;
/**
* Returns the [class`SqueezerPage]` object for `child`.
* @param child a child of @self
* @returns the page object for @child
*/
get_page(child: Gtk.Widget): SqueezerPage;
/**
* Returns a [iface`Gio`.ListModel] that contains the pages of `self`.
*
* This can be used to keep an up-to-date view. The model also implements
* [iface`Gtk`.SelectionModel] and can be used to track the visible page.
* @returns a `GtkSelectionModel` for the squeezer's children
*/
get_pages(): Gtk.SelectionModel;
/**
* Gets the switch threshold policy for `self`.
* @returns the fold threshold policy
*/
get_switch_threshold_policy(): FoldThresholdPolicy;
/**
* Gets the transition animation duration for `self`.
* @returns the transition duration, in milliseconds
*/
get_transition_duration(): number;
/**
* Gets whether a transition is currently running for `self`.
*
* If a transition is impossible, the property value will be set to `TRUE` and
* then immediately to `FALSE`, so it's possible to rely on its notifications
* to know that a transition has happened.
* @returns whether a transition is currently running
*/
get_transition_running(): boolean;
/**
* Gets the type of animation used for transitions between children in `self`.
* @returns the current transition type of @self
*/
get_transition_type(): SqueezerTransitionType;
/**
* Gets the currently visible child of `self`.
* @returns the visible child
*/
get_visible_child(): Gtk.Widget | null;
/**
* Gets the horizontal alignment, from 0 (start) to 1 (end).
* @returns the alignment value
*/
get_xalign(): number;
/**
* Gets the vertical alignment, from 0 (top) to 1 (bottom).
* @returns the alignment value
*/
get_yalign(): number;
/**
* Removes a child widget from `self`.
* @param child the child to remove
*/
remove(child: Gtk.Widget): void;
/**
* Sets whether to allow squeezing beyond the last child's minimum size.
*
* If set to `TRUE`, the squeezer can shrink to the point where no child can be
* shown. This is functionally equivalent to appending a widget with 0×0 minimum
* size.
* @param allow_none whether @self allows squeezing beyond the last child
*/
set_allow_none(allow_none: boolean): void;
/**
* Sets whether all children have the same size for the opposite orientation.
*
* For example, if a squeezer is horizontal and is homogeneous, it will request
* the same height for all its children. If it isn't, the squeezer may change
* size when a different child becomes visible.
* @param homogeneous whether @self is homogeneous
*/
set_homogeneous(homogeneous: boolean): void;
/**
* Sets whether `self` interpolates its size when changing the visible child.
*
* If `TRUE`, the squeezer will interpolate its size between the one of the
* previous visible child and the one of the new visible child, according to the
* set transition duration and the orientation, e.g. if the squeezer is
* horizontal, it will interpolate the its height.
* @param interpolate_size whether to interpolate the size
*/
set_interpolate_size(interpolate_size: boolean): void;
/**
* Sets the switch threshold policy for `self`.
*
* Determines when the squeezer will switch children.
*
* If set to `ADW_FOLD_THRESHOLD_POLICY_MINIMUM`, it will only switch when the
* visible child cannot fit anymore. With `ADW_FOLD_THRESHOLD_POLICY_NATURAL`,
* it will switch as soon as the visible child doesn't get their natural size.
*
* This can be useful if you have a long ellipsizing label and want to let it
* ellipsize instead of immediately switching.
* @param policy the policy to use
*/
set_switch_threshold_policy(policy: FoldThresholdPolicy | null): void;
/**
* Sets the transition animation duration for `self`.
* @param duration the new duration, in milliseconds
*/
set_transition_duration(duration: number): void;
/**
* Sets the type of animation used for transitions between children in `self`.
* @param transition the new transition type
*/
set_transition_type(transition: SqueezerTransitionType | null): void;
/**
* Sets the horizontal alignment, from 0 (start) to 1 (end).
*
* This affects the children allocation during transitions, when they exceed the
* size of the squeezer.
*
* For example, 0.5 means the child will be centered, 0 means it will keep the
* start side aligned and overflow the end side, and 1 means the opposite.
* @param xalign the new alignment value
*/
set_xalign(xalign: number): void;
/**
* Sets the vertical alignment, from 0 (top) to 1 (bottom).
*
* This affects the children allocation during transitions, when they exceed the
* size of the squeezer.
*
* For example, 0.5 means the child will be centered, 0 means it will keep the
* top side aligned and overflow the bottom side, and 1 means the opposite.
* @param yalign the new alignment value
*/
set_yalign(yalign: number): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* The orientation of the orientable.
*/
get orientation(): Gtk.Orientation;
set orientation(val: Gtk.Orientation);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: string): void;
/**
* Retrieves the orientation of the `orientable`.
* @returns the orientation of the @orientable
*/
get_orientation(): Gtk.Orientation;
/**
* Sets the orientation of the `orientable`.
* @param orientation the orientables new orientation
*/
set_orientation(orientation: Gtk.Orientation | null): 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 SqueezerPage {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
child: Gtk.Widget;
enabled: boolean;
}
}
/**
* An auxiliary class used by [class`Squeezer]`.
*/
class SqueezerPage extends GObject.Object {
static $gtype: GObject.GType<SqueezerPage>;
// Properties
/**
* The the squeezer child to which the page belongs.
*/
get child(): Gtk.Widget;
/**
* Whether the child is enabled.
*
* If a child is disabled, it will be ignored when looking for the child
* fitting the available size best.
*
* This allows to programmatically and prematurely hide a child even if it
* fits in the available space.
*
* This can be used e.g. to ensure a certain child is hidden below a certain
* window width, or any other constraint you find suitable.
*/
get enabled(): boolean;
set enabled(val: boolean);
// Constructors
constructor(properties?: Partial<SqueezerPage.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
// Methods
/**
* Returns the squeezer child to which `self` belongs.
* @returns the child to which @self belongs
*/
get_child(): Gtk.Widget;
/**
* Gets whether `self` is enabled.
* @returns whether @self is enabled
*/
get_enabled(): boolean;
/**
* Sets whether `self` is enabled.
*
* If a child is disabled, it will be ignored when looking for the child
* fitting the available size best.
*
* This allows to programmatically and prematurely hide a child even if it fits
* in the available space.
*
* This can be used e.g. to ensure a certain child is hidden below a certain
* window width, or any other constraint you find suitable.
* @param enabled whether @self is enabled
*/
set_enabled(enabled: boolean): void;
}
namespace StatusPage {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
child: Gtk.Widget;
description: string;
icon_name: string;
iconName: string;
paintable: Gdk.Paintable;
title: string;
}
}
/**
* A page used for empty/error states and similar use-cases.
*
* <picture>
* <source srcset="status-page-dark.png" media="(prefers-color-scheme: dark)">
* <img src="status-page.png" alt="status-page">
* </picture>
*
* The `AdwStatusPage` widget can have an icon, a title, a description and a
* custom widget which is displayed below them.
*
* ## CSS nodes
*
* `AdwStatusPage` has a main CSS node with name `statuspage`.
*
* When setting an [class`SpinnerPaintable]` as [property`StatusPage:`paintable],
* the main nodes gains the `.spinner` style class for a more compact
* appearance.
*
* ## Style classes
*
* `AdwStatusPage` can use the
* [`.compact`](style-classes.html#compact-status-page) style class for when it
* needs to fit into a small space such a sidebar or a popover, similar to when
* using a spinner as the paintable.
*
* <picture>
* <source srcset="status-page-compact-dark.png" media="(prefers-color-scheme: dark)">
* <img src="status-page-compact.png" alt="status-page-compact">
* </picture>
*/
class StatusPage extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<StatusPage>;
// Properties
/**
* The child widget.
*/
get child(): Gtk.Widget;
set child(val: Gtk.Widget);
/**
* The description markup to be displayed below the title.
*/
get description(): string;
set description(val: string);
/**
* The name of the icon to be used.
*
* Changing this will set [property`StatusPage:`paintable] to `NULL`.
*/
get icon_name(): string;
set icon_name(val: string);
/**
* The name of the icon to be used.
*
* Changing this will set [property`StatusPage:`paintable] to `NULL`.
*/
get iconName(): string;
set iconName(val: string);
/**
* The paintable to be used.
*
* Changing this will set [property`StatusPage:`icon-name] to `NULL`.
*/
get paintable(): Gdk.Paintable;
set paintable(val: Gdk.Paintable);
/**
* The title to be displayed below the icon.
*
* It is not parsed as Pango markup.
*/
get title(): string;
set title(val: string);
// Constructors
constructor(properties?: Partial<StatusPage.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): StatusPage;
// Methods
/**
* Gets the child widget of `self`.
* @returns the child widget of @self
*/
get_child(): Gtk.Widget | null;
/**
* Gets the description markup for `self`.
* @returns the description
*/
get_description(): string | null;
/**
* Gets the icon name for `self`.
* @returns the icon name
*/
get_icon_name(): string | null;
/**
* Gets the paintable for `self`.
* @returns the paintable
*/
get_paintable(): Gdk.Paintable | null;
/**
* Gets the title for `self`.
* @returns the title
*/
get_title(): string;
/**
* Sets the child widget of `self`.
* @param child the child widget
*/
set_child(child?: Gtk.Widget | null): void;
/**
* Sets the description markup for `self`.
*
* The description is displayed below the title. It is parsed as Pango markup.
* @param description the description
*/
set_description(description?: string | null): void;
/**
* Sets the icon name for `self`.
*
* Changing this will set [property`StatusPage:`paintable] to `NULL`.
* @param icon_name the icon name
*/
set_icon_name(icon_name?: string | null): void;
/**
* Sets the paintable for `self`.
*
* Changing this will set [property`StatusPage:`icon-name] to `NULL`.
* @param paintable the paintable
*/
set_paintable(paintable?: Gdk.Paintable | null): void;
/**
* Sets the title for `self`.
*
* The title is displayed below the icon. It is not parsed as Pango markup.
* @param title the title
*/
set_title(title: string): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 StyleManager {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
accent_color: AccentColor;
accentColor: AccentColor;
accent_color_rgba: Gdk.RGBA;
accentColorRgba: Gdk.RGBA;
color_scheme: ColorScheme;
colorScheme: ColorScheme;
dark: boolean;
display: Gdk.Display;
document_font_name: string;
documentFontName: string;
high_contrast: boolean;
highContrast: boolean;
monospace_font_name: string;
monospaceFontName: string;
system_supports_accent_colors: boolean;
systemSupportsAccentColors: boolean;
system_supports_color_schemes: boolean;
systemSupportsColorSchemes: boolean;
}
}
/**
* A class for managing application-wide styling.
*
* `AdwStyleManager` provides a way to query and influence the application
* styles, such as whether to use dark style, the system accent color or high
* contrast appearance.
*
* It allows to set the color scheme via the
* [property`StyleManager:`color-scheme] property, and to query the current
* appearance, as well as whether a system-wide color scheme and accent color
* preferences exists.
*/
class StyleManager extends GObject.Object {
static $gtype: GObject.GType<StyleManager>;
// Properties
/**
* The current system accent color.
*
* See also [property`StyleManager:`accent-color-rgba].
*/
get accent_color(): AccentColor;
/**
* The current system accent color.
*
* See also [property`StyleManager:`accent-color-rgba].
*/
get accentColor(): AccentColor;
/**
* The current system accent color as a `GdkRGBA`.
*
* Equivalent to calling [func`AccentColor`.to_rgba] on the value of
* [property`StyleManager:`accent-color].
*
* This is a background color. The matching foreground color is white.
*/
get accent_color_rgba(): Gdk.RGBA;
/**
* The current system accent color as a `GdkRGBA`.
*
* Equivalent to calling [func`AccentColor`.to_rgba] on the value of
* [property`StyleManager:`accent-color].
*
* This is a background color. The matching foreground color is white.
*/
get accentColorRgba(): Gdk.RGBA;
/**
* The requested application color scheme.
*
* The effective appearance will be decided based on the application color
* scheme and the system preferred color scheme. The
* [property`StyleManager:`dark] property can be used to query the current
* effective appearance.
*
* The `ADW_COLOR_SCHEME_PREFER_LIGHT` color scheme results in the application
* using light appearance unless the system prefers dark colors. This is the
* default value.
*
* The `ADW_COLOR_SCHEME_PREFER_DARK` color scheme results in the application
* using dark appearance, but can still switch to the light appearance if the
* system can prefers it, for example, when the high contrast preference is
* enabled.
*
* The `ADW_COLOR_SCHEME_FORCE_LIGHT` and `ADW_COLOR_SCHEME_FORCE_DARK` values
* ignore the system preference entirely. They are useful if the application
* wants to match its UI to its content or to provide a separate color scheme
* switcher.
*
* If a per-[class`Gdk`.Display] style manager has its color scheme set to
* `ADW_COLOR_SCHEME_DEFAULT`, it will inherit the color scheme from the
* default style manager.
*
* For the default style manager, `ADW_COLOR_SCHEME_DEFAULT` is equivalent to
* `ADW_COLOR_SCHEME_PREFER_LIGHT`.
*
* The [property`StyleManager:`system-supports-color-schemes] property can be
* used to check if the current environment provides a color scheme
* preference.
*/
get color_scheme(): ColorScheme;
set color_scheme(val: ColorScheme);
/**
* The requested application color scheme.
*
* The effective appearance will be decided based on the application color
* scheme and the system preferred color scheme. The
* [property`StyleManager:`dark] property can be used to query the current
* effective appearance.
*
* The `ADW_COLOR_SCHEME_PREFER_LIGHT` color scheme results in the application
* using light appearance unless the system prefers dark colors. This is the
* default value.
*
* The `ADW_COLOR_SCHEME_PREFER_DARK` color scheme results in the application
* using dark appearance, but can still switch to the light appearance if the
* system can prefers it, for example, when the high contrast preference is
* enabled.
*
* The `ADW_COLOR_SCHEME_FORCE_LIGHT` and `ADW_COLOR_SCHEME_FORCE_DARK` values
* ignore the system preference entirely. They are useful if the application
* wants to match its UI to its content or to provide a separate color scheme
* switcher.
*
* If a per-[class`Gdk`.Display] style manager has its color scheme set to
* `ADW_COLOR_SCHEME_DEFAULT`, it will inherit the color scheme from the
* default style manager.
*
* For the default style manager, `ADW_COLOR_SCHEME_DEFAULT` is equivalent to
* `ADW_COLOR_SCHEME_PREFER_LIGHT`.
*
* The [property`StyleManager:`system-supports-color-schemes] property can be
* used to check if the current environment provides a color scheme
* preference.
*/
get colorScheme(): ColorScheme;
set colorScheme(val: ColorScheme);
/**
* Whether the application is using dark appearance.
*
* This property can be used to query the current appearance, as requested via
* [property`StyleManager:`color-scheme].
*/
get dark(): boolean;
/**
* The display the style manager is associated with.
*
* The display will be `NULL` for the style manager returned by
* [func`StyleManager`.get_default].
*/
get display(): Gdk.Display;
/**
* The system document font.
*
* The font is in the same format as [property`Gtk`.Settings:gtk-font-name],
* e.g. "Adwaita Sans 11".
*
* Use [func`Pango`.FontDescription.to_string] to parse it.
*/
get document_font_name(): string;
/**
* The system document font.
*
* The font is in the same format as [property`Gtk`.Settings:gtk-font-name],
* e.g. "Adwaita Sans 11".
*
* Use [func`Pango`.FontDescription.to_string] to parse it.
*/
get documentFontName(): string;
/**
* Whether the application is using high contrast appearance.
*
* This cannot be overridden by applications.
*/
get high_contrast(): boolean;
/**
* Whether the application is using high contrast appearance.
*
* This cannot be overridden by applications.
*/
get highContrast(): boolean;
/**
* The system monospace font.
*
* The font is in the same format as [property`Gtk`.Settings:gtk-font-name],
* e.g. "Adwaita Mono 11".
*
* Use [func`Pango`.FontDescription.to_string] to parse it.
*/
get monospace_font_name(): string;
/**
* The system monospace font.
*
* The font is in the same format as [property`Gtk`.Settings:gtk-font-name],
* e.g. "Adwaita Mono 11".
*
* Use [func`Pango`.FontDescription.to_string] to parse it.
*/
get monospaceFontName(): string;
/**
* Whether the system supports accent colors.
*
* This property can be used to check if the current environment provides an
* accent color preference. For example, applications might want to show a
* preference for choosing accent color if it's set to `FALSE`.
*
* See [property`StyleManager:`accent-color].
*/
get system_supports_accent_colors(): boolean;
/**
* Whether the system supports accent colors.
*
* This property can be used to check if the current environment provides an
* accent color preference. For example, applications might want to show a
* preference for choosing accent color if it's set to `FALSE`.
*
* See [property`StyleManager:`accent-color].
*/
get systemSupportsAccentColors(): boolean;
/**
* Whether the system supports color schemes.
*
* This property can be used to check if the current environment provides a
* color scheme preference. For example, applications might want to show a
* separate appearance switcher if it's set to `FALSE`.
*
* See [property`StyleManager:`color-scheme].
*/
get system_supports_color_schemes(): boolean;
/**
* Whether the system supports color schemes.
*
* This property can be used to check if the current environment provides a
* color scheme preference. For example, applications might want to show a
* separate appearance switcher if it's set to `FALSE`.
*
* See [property`StyleManager:`color-scheme].
*/
get systemSupportsColorSchemes(): boolean;
// Constructors
constructor(properties?: Partial<StyleManager.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
// Static methods
/**
* Gets the default `AdwStyleManager` instance.
*
* It manages all [class`Gdk`.Display] instances unless the style manager for
* that display has an override.
*
* See [func`StyleManager`.get_for_display].
*/
static get_default(): StyleManager;
/**
* Gets the `AdwStyleManager` instance managing `display`.
*
* It can be used to override styles for that specific display instead of the
* whole application.
*
* Most applications should use [func`StyleManager`.get_default] instead.
* @param display a `GdkDisplay`
*/
static get_for_display(display: Gdk.Display): StyleManager;
// Methods
/**
* Gets the current system accent color.
*
* See also [property`StyleManager:`accent-color-rgba].
* @returns the current system accent color
*/
get_accent_color(): AccentColor;
/**
* Gets the current system accent color as a `GdkRGBA`.
*
* Equivalent to calling [func`AccentColor`.to_rgba] on the value of
* [property`StyleManager:`accent-color].
*
* This is a background color. The matching foreground color is white.
* @returns the current system accent color
*/
get_accent_color_rgba(): Gdk.RGBA;
/**
* Gets the requested application color scheme.
* @returns the color scheme
*/
get_color_scheme(): ColorScheme;
/**
* Gets whether the application is using dark appearance.
*
* This can be used to query the current appearance, as requested via
* [property`StyleManager:`color-scheme].
* @returns whether the application is using dark appearance
*/
get_dark(): boolean;
/**
* Gets the display the style manager is associated with.
*
* The display will be `NULL` for the style manager returned by
* [func`StyleManager`.get_default].
* @returns the display
*/
get_display(): Gdk.Display | null;
/**
* Gets the system document font.
*
* The font is in the same format as [property`Gtk`.Settings:gtk-font-name],
* e.g. "Adwaita Sans 11".
*
* Use [func`Pango`.FontDescription.to_string] to parse it.
* @returns the system document font
*/
get_document_font_name(): string;
/**
* Gets whether the application is using high contrast appearance.
*
* This cannot be overridden by applications.
* @returns whether the application is using high contrast appearance
*/
get_high_contrast(): boolean;
/**
* Gets the system monospace font.
*
* The font is in the same format as [property`Gtk`.Settings:gtk-font-name],
* e.g. "Adwaita Mono 11".
*
* Use [func`Pango`.FontDescription.to_string] to parse it.
* @returns the system monospace font
*/
get_monospace_font_name(): string;
/**
* Gets whether the system supports accent colors.
*
* This can be used to check if the current environment provides an accent color
* preference. For example, applications might want to show a preference for
* choosing accent color if it's set to `FALSE`.
*
* See [property`StyleManager:`accent-color].
* @returns whether the system supports accent colors
*/
get_system_supports_accent_colors(): boolean;
/**
* Gets whether the system supports color schemes.
*
* This can be used to check if the current environment provides a color scheme
* preference. For example, applications might want to show a separate
* appearance switcher if it's set to `FALSE`.
* @returns whether the system supports color schemes
*/
get_system_supports_color_schemes(): boolean;
/**
* Sets the requested application color scheme.
*
* The effective appearance will be decided based on the application color
* scheme and the system preferred color scheme. The
* [property`StyleManager:`dark] property can be used to query the current
* effective appearance.
*
* The `ADW_COLOR_SCHEME_PREFER_LIGHT` color scheme results in the application
* using light appearance unless the system prefers dark colors. This is the
* default value.
*
* The `ADW_COLOR_SCHEME_PREFER_DARK` color scheme results in the application
* using dark appearance, but can still switch to the light appearance if the
* system can prefers it, for example, when the high contrast preference is
* enabled.
*
* The `ADW_COLOR_SCHEME_FORCE_LIGHT` and `ADW_COLOR_SCHEME_FORCE_DARK` values
* ignore the system preference entirely. They are useful if the application
* wants to match its UI to its content or to provide a separate color scheme
* switcher.
*
* If a per-[class`Gdk`.Display] style manager has its color scheme set to
* `ADW_COLOR_SCHEME_DEFAULT`, it will inherit the color scheme from the
* default style manager.
*
* For the default style manager, `ADW_COLOR_SCHEME_DEFAULT` is equivalent to
* `ADW_COLOR_SCHEME_PREFER_LIGHT`.
*
* The [property`StyleManager:`system-supports-color-schemes] property can be
* used to check if the current environment provides a color scheme
* preference.
* @param color_scheme the color scheme
*/
set_color_scheme(color_scheme: ColorScheme | null): void;
}
namespace SwipeTracker {
// Signal callback interfaces
interface BeginSwipe {
(): void;
}
interface EndSwipe {
(velocity: number, to: number): void;
}
interface Prepare {
(direction: NavigationDirection): void;
}
interface UpdateSwipe {
(progress: number): void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, Gtk.Orientable.ConstructorProps {
allow_long_swipes: boolean;
allowLongSwipes: boolean;
allow_mouse_drag: boolean;
allowMouseDrag: boolean;
allow_window_handle: boolean;
allowWindowHandle: boolean;
enabled: boolean;
lower_overshoot: boolean;
lowerOvershoot: boolean;
reversed: boolean;
swipeable: Swipeable;
upper_overshoot: boolean;
upperOvershoot: boolean;
}
}
/**
* A swipe tracker used in [class`Carousel]`, [class`NavigationView]` and
* [class`OverlaySplitView]`.
*
* The `AdwSwipeTracker` object can be used for implementing widgets with swipe
* gestures. It supports touch-based swipes, pointer dragging, and touchpad
* scrolling.
*
* The widgets will probably want to expose the [property`SwipeTracker:`enabled]
* property. If they expect to use horizontal orientation,
* [property`SwipeTracker:`reversed] can be used for supporting RTL text
* direction.
*/
class SwipeTracker extends GObject.Object implements Gtk.Orientable {
static $gtype: GObject.GType<SwipeTracker>;
// Properties
/**
* Whether to allow swiping for more than one snap point at a time.
*
* If the value is `FALSE`, each swipe can only move to the adjacent snap
* points.
*/
get allow_long_swipes(): boolean;
set allow_long_swipes(val: boolean);
/**
* Whether to allow swiping for more than one snap point at a time.
*
* If the value is `FALSE`, each swipe can only move to the adjacent snap
* points.
*/
get allowLongSwipes(): boolean;
set allowLongSwipes(val: boolean);
/**
* Whether to allow dragging with mouse pointer.
*/
get allow_mouse_drag(): boolean;
set allow_mouse_drag(val: boolean);
/**
* Whether to allow dragging with mouse pointer.
*/
get allowMouseDrag(): boolean;
set allowMouseDrag(val: boolean);
/**
* Whether to allow touchscreen swiping from `GtkWindowHandle`.
*
* This will make dragging the window impossible.
*/
get allow_window_handle(): boolean;
set allow_window_handle(val: boolean);
/**
* Whether to allow touchscreen swiping from `GtkWindowHandle`.
*
* This will make dragging the window impossible.
*/
get allowWindowHandle(): boolean;
set allowWindowHandle(val: boolean);
/**
* Whether the swipe tracker is enabled.
*
* When it's not enabled, no events will be processed. Usually widgets will
* want to expose this via a property.
*/
get enabled(): boolean;
set enabled(val: boolean);
/**
* Whether to allow swiping past the first available snap point.
*/
get lower_overshoot(): boolean;
set lower_overshoot(val: boolean);
/**
* Whether to allow swiping past the first available snap point.
*/
get lowerOvershoot(): boolean;
set lowerOvershoot(val: boolean);
/**
* Whether to reverse the swipe direction.
*
* If the swipe tracker is horizontal, it can be used for supporting RTL text
* direction.
*/
get reversed(): boolean;
set reversed(val: boolean);
/**
* The widget the swipe tracker is attached to.
*/
get swipeable(): Swipeable;
/**
* Whether to allow swiping past the last available snap point.
*/
get upper_overshoot(): boolean;
set upper_overshoot(val: boolean);
/**
* Whether to allow swiping past the last available snap point.
*/
get upperOvershoot(): boolean;
set upperOvershoot(val: boolean);
// Constructors
constructor(properties?: Partial<SwipeTracker.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](swipeable: Swipeable): SwipeTracker;
// 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: 'begin-swipe', callback: (_source: this) => void): number;
connect_after(signal: 'begin-swipe', callback: (_source: this) => void): number;
emit(signal: 'begin-swipe'): void;
connect(signal: 'end-swipe', callback: (_source: this, velocity: number, to: number) => void): number;
connect_after(signal: 'end-swipe', callback: (_source: this, velocity: number, to: number) => void): number;
emit(signal: 'end-swipe', velocity: number, to: number): void;
connect(signal: 'prepare', callback: (_source: this, direction: NavigationDirection) => void): number;
connect_after(signal: 'prepare', callback: (_source: this, direction: NavigationDirection) => void): number;
emit(signal: 'prepare', direction: NavigationDirection): void;
connect(signal: 'update-swipe', callback: (_source: this, progress: number) => void): number;
connect_after(signal: 'update-swipe', callback: (_source: this, progress: number) => void): number;
emit(signal: 'update-swipe', progress: number): void;
// Methods
/**
* Gets whether to allow swiping for more than one snap point at a time.
* @returns whether long swipes are allowed
*/
get_allow_long_swipes(): boolean;
/**
* Gets whether `self` can be dragged with mouse pointer.
* @returns whether mouse dragging is allowed
*/
get_allow_mouse_drag(): boolean;
/**
* Gets whether to allow touchscreen swiping from `GtkWindowHandle`.
* @returns whether swiping from window handles is allowed
*/
get_allow_window_handle(): boolean;
/**
* Gets whether `self` is enabled.
* @returns whether @self is enabled
*/
get_enabled(): boolean;
/**
* Gets whether to allow swiping past the first available snap point.
* @returns whether to allow swiping past the first available snap point
*/
get_lower_overshoot(): boolean;
/**
* Gets whether `self` is reversing the swipe direction.
* @returns whether the direction is reversed
*/
get_reversed(): boolean;
/**
* Get the widget `self` is attached to.
* @returns the swipeable widget
*/
get_swipeable(): Swipeable;
/**
* Gets whether to allow swiping past the last available snap point.
* @returns whether to allow swiping past the last available snap point
*/
get_upper_overshoot(): boolean;
/**
* Sets whether to allow swiping for more than one snap point at a time.
*
* If the value is `FALSE`, each swipe can only move to the adjacent snap
* points.
* @param allow_long_swipes whether to allow long swipes
*/
set_allow_long_swipes(allow_long_swipes: boolean): void;
/**
* Sets whether `self` can be dragged with mouse pointer.
* @param allow_mouse_drag whether to allow mouse dragging
*/
set_allow_mouse_drag(allow_mouse_drag: boolean): void;
/**
* Sets whether to allow touchscreen swiping from `GtkWindowHandle`.
*
* Setting it to `TRUE` will make dragging the window impossible.
* @param allow_window_handle whether to allow swiping from window handles
*/
set_allow_window_handle(allow_window_handle: boolean): void;
/**
* Sets whether `self` is enabled.
*
* When it's not enabled, no events will be processed. Usually widgets will want
* to expose this via a property.
* @param enabled whether @self is enabled
*/
set_enabled(enabled: boolean): void;
/**
* Sets whether to allow swiping past the first available snap point.
* @param overshoot whether to allow swiping past the first available snap point
*/
set_lower_overshoot(overshoot: boolean): void;
/**
* Sets whether to reverse the swipe direction.
*
* If the swipe tracker is horizontal, it can be used for supporting RTL text
* direction.
* @param reversed whether to reverse the swipe direction
*/
set_reversed(reversed: boolean): void;
/**
* Sets whether to allow swiping past the last available snap point.
* @param overshoot whether to allow swiping past the last available snap point
*/
set_upper_overshoot(overshoot: boolean): void;
/**
* Moves the current progress value by `delta`.
*
* This can be used to adjust the current position if snap points move during
* the gesture.
* @param delta the position delta
*/
shift_position(delta: number): void;
// Inherited properties
/**
* The orientation of the orientable.
*/
get orientation(): Gtk.Orientation;
set orientation(val: Gtk.Orientation);
// Inherited methods
/**
* Retrieves the orientation of the `orientable`.
* @returns the orientation of the @orientable
*/
get_orientation(): Gtk.Orientation;
/**
* Sets the orientation of the `orientable`.
* @param orientation the orientables new orientation
*/
set_orientation(orientation: Gtk.Orientation | null): 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 SwitchRow {
// Constructor properties interface
interface ConstructorProps
extends ActionRow.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Actionable.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
active: boolean;
}
}
/**
* A [class`Gtk`.ListBoxRow] used to represent two states.
*
* <picture>
* <source srcset="switch-row-dark.png" media="(prefers-color-scheme: dark)">
* <img src="switch-row.png" alt="switch-row">
* </picture>
*
* The `AdwSwitchRow` widget contains a [class`Gtk`.Switch] that allows the user
* to select between two states: "on" or "off". When activated, the row will
* invert its active state.
*
* The user can control the switch by activating the row or by dragging on the
* switch handle.
*
* See [class`Gtk`.Switch] for details.
*
* Example of an `AdwSwitchRow` UI definition:
* ```xml
* <object class="AdwSwitchRow">
* <property name="title" translatable="yes">Switch Row</property>
* <signal name="notify::active" handler="switch_row_notify_active_cb"/>
* </object>
* ```
*
* The [property`SwitchRow:`active] property should be connected to in order to
* monitor changes to the active state.
*
* ## Accessibility
*
* `AdwSwitchRow` uses the `GTK_ACCESSIBLE_ROLE_SWITCH` role.
*/
class SwitchRow
extends ActionRow
implements Gtk.Accessible, Gtk.Actionable, Gtk.Buildable, Gtk.ConstraintTarget
{
static $gtype: GObject.GType<SwitchRow>;
// Properties
/**
* Whether the switch row is in the "on" or "off" position.
*/
get active(): boolean;
set active(val: boolean);
// Constructors
constructor(properties?: Partial<SwitchRow.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): SwitchRow;
// Methods
/**
* Gets whether `self` is in its "on" or "off" position.
* @returns whether @self is active or not
*/
get_active(): boolean;
/**
* Sets whether `self` is in its "on" or "off" position
* @param is_active whether @self should be active
*/
set_active(is_active: boolean): void;
// Inherited properties
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// 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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
// Conflicted with Adw.ActionRow.activate
activate(...args: never[]): any;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace TabBar {
// Signal callback interfaces
interface ExtraDragDrop {
(page: TabPage, value: GObject.Value | any): boolean;
}
interface ExtraDragValue {
(page: TabPage, value: GObject.Value | any): Gdk.DragAction;
}
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
autohide: boolean;
end_action_widget: Gtk.Widget;
endActionWidget: Gtk.Widget;
expand_tabs: boolean;
expandTabs: boolean;
extra_drag_preferred_action: Gdk.DragAction;
extraDragPreferredAction: Gdk.DragAction;
extra_drag_preload: boolean;
extraDragPreload: boolean;
inverted: boolean;
is_overflowing: boolean;
isOverflowing: boolean;
start_action_widget: Gtk.Widget;
startActionWidget: Gtk.Widget;
tabs_revealed: boolean;
tabsRevealed: boolean;
view: TabView;
}
}
/**
* A tab bar for [class`TabView]`.
*
* <picture>
* <source srcset="tab-bar-dark.png" media="(prefers-color-scheme: dark)">
* <img src="tab-bar.png" alt="tab-bar">
* </picture>
*
* The `AdwTabBar` widget is a tab bar that can be used with conjunction with
* `AdwTabView`. It is typically used as a top bar within [class`ToolbarView]`.
*
* `AdwTabBar` can autohide and can optionally contain action widgets on both
* sides of the tabs.
*
* When there's not enough space to show all the tabs, `AdwTabBar` will scroll
* them. Pinned tabs always stay visible and aren't a part of the scrollable
* area.
*
* ## CSS nodes
*
* `AdwTabBar` has a single CSS node with name `tabbar`.
*
* ## Style classes
*
* By default `AdwTabBar` look like a part of an `AdwHeaderBar` and is intended
* to be used directly attached to one or used as a [class`ToolbarView]` toolbar.
* The [`.inline`](style-classes.html#inline) style class removes its background,
* so that it can be used in different contexts instead.
*
* <picture>
* <source srcset="tab-bar-inline-dark.png" media="(prefers-color-scheme: dark)">
* <img src="tab-bar-inline.png" alt="tab-bar-inline">
* </picture>
*/
class TabBar extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<TabBar>;
// Properties
/**
* Whether the tabs automatically hide.
*
* If set to `TRUE`, the tab bar disappears when [property`TabBar:`view] has 0
* or 1 tab, no pinned tabs, and no tab is being transferred.
*
* See [property`TabBar:`tabs-revealed].
*/
get autohide(): boolean;
set autohide(val: boolean);
/**
* The widget shown after the tabs.
*/
get end_action_widget(): Gtk.Widget;
set end_action_widget(val: Gtk.Widget);
/**
* The widget shown after the tabs.
*/
get endActionWidget(): Gtk.Widget;
set endActionWidget(val: Gtk.Widget);
/**
* Whether tabs expand to full width.
*
* If set to `TRUE`, the tabs will always vary width filling the whole width
* when possible, otherwise tabs will always have the minimum possible size.
*/
get expand_tabs(): boolean;
set expand_tabs(val: boolean);
/**
* Whether tabs expand to full width.
*
* If set to `TRUE`, the tabs will always vary width filling the whole width
* when possible, otherwise tabs will always have the minimum possible size.
*/
get expandTabs(): boolean;
set expandTabs(val: boolean);
/**
* The unique action on the `current-drop` of the
* [signal`TabBar:`:extra-drag-drop].
*
* This property should only be used during a [signal`TabBar:`:extra-drag-drop]
* and is always a subset of what was originally passed to
* [method`TabBar`.setup_extra_drop_target].
*/
get extra_drag_preferred_action(): Gdk.DragAction;
/**
* The unique action on the `current-drop` of the
* [signal`TabBar:`:extra-drag-drop].
*
* This property should only be used during a [signal`TabBar:`:extra-drag-drop]
* and is always a subset of what was originally passed to
* [method`TabBar`.setup_extra_drop_target].
*/
get extraDragPreferredAction(): Gdk.DragAction;
/**
* Whether the drop data should be preloaded on hover.
*
* See [property`Gtk`.DropTarget:preload].
*/
get extra_drag_preload(): boolean;
set extra_drag_preload(val: boolean);
/**
* Whether the drop data should be preloaded on hover.
*
* See [property`Gtk`.DropTarget:preload].
*/
get extraDragPreload(): boolean;
set extraDragPreload(val: boolean);
/**
* Whether tabs use inverted layout.
*
* If set to `TRUE`, non-pinned tabs will have the close button at the
* beginning and the indicator at the end rather than the opposite.
*/
get inverted(): boolean;
set inverted(val: boolean);
/**
* Whether the tab bar is overflowing.
*
* If `TRUE`, all tabs cannot be displayed at once and require scrolling.
*/
get is_overflowing(): boolean;
/**
* Whether the tab bar is overflowing.
*
* If `TRUE`, all tabs cannot be displayed at once and require scrolling.
*/
get isOverflowing(): boolean;
/**
* The widget shown before the tabs.
*/
get start_action_widget(): Gtk.Widget;
set start_action_widget(val: Gtk.Widget);
/**
* The widget shown before the tabs.
*/
get startActionWidget(): Gtk.Widget;
set startActionWidget(val: Gtk.Widget);
/**
* Whether the tabs are currently revealed.
*
* See [property`TabBar:`autohide].
*/
get tabs_revealed(): boolean;
/**
* Whether the tabs are currently revealed.
*
* See [property`TabBar:`autohide].
*/
get tabsRevealed(): boolean;
/**
* The tab view the tab bar controls.
*/
get view(): TabView;
set view(val: TabView);
// Constructors
constructor(properties?: Partial<TabBar.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): TabBar;
// 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: 'extra-drag-drop',
callback: (_source: this, page: TabPage, value: GObject.Value) => boolean,
): number;
connect_after(
signal: 'extra-drag-drop',
callback: (_source: this, page: TabPage, value: GObject.Value) => boolean,
): number;
emit(signal: 'extra-drag-drop', page: TabPage, value: GObject.Value | any): void;
connect(
signal: 'extra-drag-value',
callback: (_source: this, page: TabPage, value: GObject.Value) => Gdk.DragAction,
): number;
connect_after(
signal: 'extra-drag-value',
callback: (_source: this, page: TabPage, value: GObject.Value) => Gdk.DragAction,
): number;
emit(signal: 'extra-drag-value', page: TabPage, value: GObject.Value | any): void;
// Methods
/**
* Gets whether the tabs automatically hide.
* @returns whether the tabs automatically hide
*/
get_autohide(): boolean;
/**
* Gets the widget shown after the tabs.
* @returns the widget shown after the tabs
*/
get_end_action_widget(): Gtk.Widget | null;
/**
* Gets whether tabs expand to full width.
* @returns whether tabs expand to full width.
*/
get_expand_tabs(): boolean;
/**
* Gets the current action during a drop on the extra_drop_target.
* @returns the drag action of the current drop.
*/
get_extra_drag_preferred_action(): Gdk.DragAction;
/**
* Gets whether drop data should be preloaded on hover.
* @returns whether drop data should be preloaded on hover
*/
get_extra_drag_preload(): boolean;
/**
* Gets whether tabs use inverted layout.
* @returns whether tabs use inverted layout
*/
get_inverted(): boolean;
/**
* Gets whether `self` is overflowing.
*
* If `TRUE`, all tabs cannot be displayed at once and require scrolling.
* @returns whether @self is overflowing
*/
get_is_overflowing(): boolean;
/**
* Gets the widget shown before the tabs.
* @returns the widget shown before the tabs
*/
get_start_action_widget(): Gtk.Widget | null;
/**
* Gets whether the tabs are currently revealed.
*
* See [property`TabBar:`autohide].
* @returns whether the tabs are currently revealed
*/
get_tabs_revealed(): boolean;
/**
* Gets the tab view `self` controls.
* @returns the view @self controls
*/
get_view(): TabView | null;
/**
* Sets whether the tabs automatically hide.
*
* If set to `TRUE`, the tab bar disappears when [property`TabBar:`view] has 0
* or 1 tab, no pinned tabs, and no tab is being transferred.
*
* See [property`TabBar:`tabs-revealed].
* @param autohide whether the tabs automatically hide
*/
set_autohide(autohide: boolean): void;
/**
* Sets the widget to show after the tabs.
* @param widget the widget to show after the tabs
*/
set_end_action_widget(widget?: Gtk.Widget | null): void;
/**
* Sets whether tabs expand to full width.
*
* If set to `TRUE`, the tabs will always vary width filling the whole width
* when possible, otherwise tabs will always have the minimum possible size.
* @param expand_tabs whether to expand tabs
*/
set_expand_tabs(expand_tabs: boolean): void;
/**
* Sets whether drop data should be preloaded on hover.
*
* See [property`Gtk`.DropTarget:preload].
* @param preload whether to preload drop data
*/
set_extra_drag_preload(preload: boolean): void;
/**
* Sets whether tabs tabs use inverted layout.
*
* If set to `TRUE`, non-pinned tabs will have the close button at the beginning
* and the indicator at the end rather than the opposite.
* @param inverted whether tabs use inverted layout
*/
set_inverted(inverted: boolean): void;
/**
* Sets the widget to show before the tabs.
* @param widget the widget to show before the tabs
*/
set_start_action_widget(widget?: Gtk.Widget | null): void;
/**
* Sets the tab view `self` controls.
* @param view a tab view
*/
set_view(view?: TabView | null): void;
/**
* Sets the supported types for this drop target.
*
* Sets up an extra drop target on tabs.
*
* This allows to drag arbitrary content onto tabs, for example URLs in a web
* browser.
*
* If a tab is hovered for a certain period of time while dragging the content,
* it will be automatically selected.
*
* The [signal`TabBar:`:extra-drag-drop] signal can be used to handle the drop.
* @param actions the supported actions
* @param types all supported `GType`s that can be dropped
*/
setup_extra_drop_target(actions: Gdk.DragAction | null, types?: GObject.GType[] | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 TabButton {
// Signal callback interfaces
interface Activate {
(): void;
}
interface Clicked {
(): void;
}
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Actionable.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
view: TabView;
}
}
/**
* A button that displays the number of [class`TabView]` pages.
*
* <picture>
* <source srcset="tab-button-dark.png" media="(prefers-color-scheme: dark)">
* <img src="tab-button.png" alt="tab-button">
* </picture>
*
* `AdwTabButton` is a button that displays the number of pages in a given
* `AdwTabView`, as well as whether one of the inactive pages needs attention.
*
* It's intended to be used as a visible indicator when there's no visible tab
* bar, typically opening an [class`TabOverview]` on click, e.g. via the
* `overview.open` action name:
*
* ```xml
* <object class="AdwTabButton">
* <property name="view">view</property>
* <property name="action-name">overview.open</property>
* </object>
* ```
*
* ## CSS nodes
*
* `AdwTabButton` has a main CSS node with name `tabbutton`.
*
* # Accessibility
*
* `AdwTabButton` uses the `GTK_ACCESSIBLE_ROLE_BUTTON` role.
*/
class TabButton
extends Gtk.Widget
implements Gtk.Accessible, Gtk.Actionable, Gtk.Buildable, Gtk.ConstraintTarget
{
static $gtype: GObject.GType<TabButton>;
// Properties
/**
* The view the tab button displays.
*/
get view(): TabView;
set view(val: TabView);
// Constructors
constructor(properties?: Partial<TabButton.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): TabButton;
// 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) => void): number;
connect_after(signal: 'activate', callback: (_source: this) => void): number;
emit(signal: 'activate'): void;
connect(signal: 'clicked', callback: (_source: this) => void): number;
connect_after(signal: 'clicked', callback: (_source: this) => void): number;
emit(signal: 'clicked'): void;
// Methods
/**
* Gets the tab view `self` displays.
* @returns the tab view
*/
get_view(): TabView | null;
/**
* Sets the tab view to display.
* @param view a tab view
*/
set_view(view?: TabView | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* The name of the action with which this widget should be associated.
*/
get action_name(): string;
set action_name(val: string);
/**
* The name of the action with which this widget should be associated.
*/
get actionName(): string;
set actionName(val: string);
/**
* The target value of the actionable widget's action.
*/
get action_target(): GLib.Variant;
set action_target(val: GLib.Variant);
/**
* The target value of the actionable widget's action.
*/
get actionTarget(): GLib.Variant;
set actionTarget(val: GLib.Variant);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the action name for `actionable`.
* @returns the action name
*/
get_action_name(): string | null;
/**
* Gets the current target value of `actionable`.
* @returns the current target value
*/
get_action_target_value(): GLib.Variant | null;
/**
* Specifies the name of the action with which this widget should be
* associated.
*
* If `action_name` is %NULL then the widget will be unassociated from
* any previous action.
*
* Usually this function is used when the widget is located (or will be
* located) within the hierarchy of a `GtkApplicationWindow`.
*
* Names are of the form “win.save” or “app.quit” for actions on the
* containing [class`ApplicationWindow]` or its associated [class`Application]`,
* respectively. This is the same form used for actions in the [class`Gio`.Menu]
* associated with the window.
* @param action_name an action name
*/
set_action_name(action_name?: string | null): void;
/**
* Sets the target value of an actionable widget.
*
* If `target_value` is %NULL then the target value is unset.
*
* The target value has two purposes. First, it is used as the parameter
* to activation of the action associated with the `GtkActionable` widget.
* Second, it is used to determine if the widget should be rendered as
* “active” — the widget is active if the state is equal to the given target.
*
* Consider the example of associating a set of buttons with a [iface`Gio`.Action]
* with string state in a typical “radio button” situation. Each button
* will be associated with the same action, but with a different target
* value for that action. Clicking on a particular button will activate
* the action with the target of that button, which will typically cause
* the actions state to change to that value. Since the actions state
* is now equal to the target value of the button, the button will now
* be rendered as active (and the other buttons, with different targets,
* rendered inactive).
* @param target_value a [struct@GLib.Variant] to set as the target value
*/
set_action_target_value(target_value?: GLib.Variant | null): void;
/**
* Sets the action-name and associated string target value of an
* actionable widget.
*
* `detailed_action_name` is a string in the format accepted by
* [func`Gio`.Action.parse_detailed_name].
* @param detailed_action_name the detailed action name
*/
set_detailed_action_name(detailed_action_name: string): void;
/**
* Gets the action name for `actionable`.
*/
vfunc_get_action_name(): string | null;
/**
* Gets the current target value of `actionable`.
*/
vfunc_get_action_target_value(): GLib.Variant | null;
/**
* Specifies the name of the action with which this widget should be
* associated.
*
* If `action_name` is %NULL then the widget will be unassociated from
* any previous action.
*
* Usually this function is used when the widget is located (or will be
* located) within the hierarchy of a `GtkApplicationWindow`.
*
* Names are of the form “win.save” or “app.quit” for actions on the
* containing [class`ApplicationWindow]` or its associated [class`Application]`,
* respectively. This is the same form used for actions in the [class`Gio`.Menu]
* associated with the window.
* @param action_name an action name
*/
vfunc_set_action_name(action_name?: string | null): void;
/**
* Sets the target value of an actionable widget.
*
* If `target_value` is %NULL then the target value is unset.
*
* The target value has two purposes. First, it is used as the parameter
* to activation of the action associated with the `GtkActionable` widget.
* Second, it is used to determine if the widget should be rendered as
* “active” — the widget is active if the state is equal to the given target.
*
* Consider the example of associating a set of buttons with a [iface`Gio`.Action]
* with string state in a typical “radio button” situation. Each button
* will be associated with the same action, but with a different target
* value for that action. Clicking on a particular button will activate
* the action with the target of that button, which will typically cause
* the actions state to change to that value. Since the actions state
* is now equal to the target value of the button, the button will now
* be rendered as active (and the other buttons, with different targets,
* rendered inactive).
* @param target_value a [struct@GLib.Variant] to set as the target value
*/
vfunc_set_action_target_value(target_value?: GLib.Variant | null): void;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Get the display for the window that the widget belongs to.
*
* This function can only be called after the widget has been
* added to a widget hierarchy with a `GtkRoot` at the top.
*
* In general, you should only create display-specific
* resources when a widget has been realized, and you should
* free those resources when the widget is unrealized.
* @returns the display for this widget
*/
get_display(): Gdk.Display;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
realize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
unrealize(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace TabOverview {
// Signal callback interfaces
interface CreateTab {
(): TabPage;
}
interface ExtraDragDrop {
(page: TabPage, value: GObject.Value | any): boolean;
}
interface ExtraDragValue {
(page: TabPage, value: GObject.Value | any): Gdk.DragAction;
}
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
child: Gtk.Widget;
enable_new_tab: boolean;
enableNewTab: boolean;
enable_search: boolean;
enableSearch: boolean;
extra_drag_preferred_action: Gdk.DragAction;
extraDragPreferredAction: Gdk.DragAction;
extra_drag_preload: boolean;
extraDragPreload: boolean;
inverted: boolean;
open: boolean;
search_active: boolean;
searchActive: boolean;
secondary_menu: Gio.MenuModel;
secondaryMenu: Gio.MenuModel;
show_end_title_buttons: boolean;
showEndTitleButtons: boolean;
show_start_title_buttons: boolean;
showStartTitleButtons: boolean;
view: TabView;
}
}
/**
* A tab overview for [class`TabView]`.
*
* <picture>
* <source srcset="tab-overview-dark.png" media="(prefers-color-scheme: dark)">
* <img src="tab-overview.png" alt="tab-overview">
* </picture>
*
* `AdwTabOverview` is a widget that can display tabs from an `AdwTabView` in a
* grid.
*
* `AdwTabOverview` shows a thumbnail for each tab. By default thumbnails are
* static for all pages except the selected one. They can be made always live
* by setting [property`TabPage:`live-thumbnail] to `TRUE`, or refreshed with
* [method`TabPage`.invalidate_thumbnail] or
* [method`TabView`.invalidate_thumbnails] otherwise.
*
* If the pages are too tall or too wide, the thumbnails will be cropped; use
* [property`TabPage:`thumbnail-xalign] and [property`TabPage:`thumbnail-yalign] to
* control which part of the page should be visible in this case.
*
* Pinned tabs are shown as smaller cards without thumbnails above the other
* tabs. Unlike in [class`TabBar]`, they still have titles, as well as an unpin
* button.
*
* `AdwTabOverview` provides search in open tabs. It searches in tab titles and
* tooltips, as well as [property`TabPage:`keyword].
*
* If [property`TabOverview:`enable-new-tab] is set to `TRUE`, a new tab button
* will be shown. Connect to the [signal`TabOverview:`:create-tab] signal to use
* it.
*
* [property`TabOverview:`secondary-menu] can be used to provide a secondary menu
* for the overview. Use it to add extra actions, e.g. to open a new window or
* undo closed tab.
*
* `AdwTabOverview` is intended to be used as the direct child of the window,
* with the rest of the window contents set as the [property`TabOverview:`child].
* The child is expected to contain an [class`TabView]`.
*
* `AdwTabOverview` shows window buttons by default. They can be disabled by
* setting [property`TabOverview:`show-start-title-buttons] and/or
* [property`TabOverview:`show-start-title-buttons] and/or
* [property`TabOverview:`show-end-title-buttons] to `FALSE`.
*
* If search and window buttons are disabled, and secondary menu is not set, the
* header bar will be hidden.
*
* ## Actions
*
* `AdwTabOverview` defines the `overview.open` and `overview.close` actions for
* opening and closing itself. They can be convenient when used together with
* [class`TabButton]`.
*
* ## CSS nodes
*
* `AdwTabOverview` has a single CSS node with name `taboverview`.
*/
class TabOverview extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<TabOverview>;
// Properties
/**
* The child widget.
*/
get child(): Gtk.Widget;
set child(val: Gtk.Widget);
/**
* Whether to enable new tab button.
*
* Connect to the [signal`TabOverview:`:create-tab] signal to use it.
*/
get enable_new_tab(): boolean;
set enable_new_tab(val: boolean);
/**
* Whether to enable new tab button.
*
* Connect to the [signal`TabOverview:`:create-tab] signal to use it.
*/
get enableNewTab(): boolean;
set enableNewTab(val: boolean);
/**
* Whether to enable search in tabs.
*
* Search matches tab titles and tooltips, as well as keywords, set via
* [property`TabPage:`keyword]. Use keywords to search in e.g. page URLs in a
* web browser.
*
* During search, tab reordering and drag-n-drop are disabled.
*
* Use [property`TabOverview:`search-active] to check out if search is
* currently active.
*/
get enable_search(): boolean;
set enable_search(val: boolean);
/**
* Whether to enable search in tabs.
*
* Search matches tab titles and tooltips, as well as keywords, set via
* [property`TabPage:`keyword]. Use keywords to search in e.g. page URLs in a
* web browser.
*
* During search, tab reordering and drag-n-drop are disabled.
*
* Use [property`TabOverview:`search-active] to check out if search is
* currently active.
*/
get enableSearch(): boolean;
set enableSearch(val: boolean);
/**
* The unique action on the `current-drop` of the
* [signal`TabOverview:`:extra-drag-drop].
*
* This property should only be used during a
* [signal`TabOverview:`:extra-drag-drop] and is always a subset of what was
* originally passed to [method`TabOverview`.setup_extra_drop_target].
*/
get extra_drag_preferred_action(): Gdk.DragAction;
/**
* The unique action on the `current-drop` of the
* [signal`TabOverview:`:extra-drag-drop].
*
* This property should only be used during a
* [signal`TabOverview:`:extra-drag-drop] and is always a subset of what was
* originally passed to [method`TabOverview`.setup_extra_drop_target].
*/
get extraDragPreferredAction(): Gdk.DragAction;
/**
* Whether the drop data should be preloaded on hover.
*
* See [property`Gtk`.DropTarget:preload].
*/
get extra_drag_preload(): boolean;
set extra_drag_preload(val: boolean);
/**
* Whether the drop data should be preloaded on hover.
*
* See [property`Gtk`.DropTarget:preload].
*/
get extraDragPreload(): boolean;
set extraDragPreload(val: boolean);
/**
* Whether thumbnails use inverted layout.
*
* If set to `TRUE`, thumbnails will have the close or unpin buttons at the
* beginning and the indicator at the end rather than the other way around.
*/
get inverted(): boolean;
set inverted(val: boolean);
/**
* Whether the overview is open.
*/
get open(): boolean;
set open(val: boolean);
/**
* Whether search is currently active.
*
* See [property`TabOverview:`enable-search].
*/
get search_active(): boolean;
/**
* Whether search is currently active.
*
* See [property`TabOverview:`enable-search].
*/
get searchActive(): boolean;
/**
* The secondary menu model.
*
* Use it to add extra actions, e.g. to open a new window or undo closed tab.
*/
get secondary_menu(): Gio.MenuModel;
set secondary_menu(val: Gio.MenuModel);
/**
* The secondary menu model.
*
* Use it to add extra actions, e.g. to open a new window or undo closed tab.
*/
get secondaryMenu(): Gio.MenuModel;
set secondaryMenu(val: Gio.MenuModel);
/**
* Whether to show end title buttons in the overview's header bar.
*
* See [property`HeaderBar:`show-start-title-buttons] for the other side.
*/
get show_end_title_buttons(): boolean;
set show_end_title_buttons(val: boolean);
/**
* Whether to show end title buttons in the overview's header bar.
*
* See [property`HeaderBar:`show-start-title-buttons] for the other side.
*/
get showEndTitleButtons(): boolean;
set showEndTitleButtons(val: boolean);
/**
* Whether to show start title buttons in the overview's header bar.
*
* See [property`HeaderBar:`show-end-title-buttons] for the other side.
*/
get show_start_title_buttons(): boolean;
set show_start_title_buttons(val: boolean);
/**
* Whether to show start title buttons in the overview's header bar.
*
* See [property`HeaderBar:`show-end-title-buttons] for the other side.
*/
get showStartTitleButtons(): boolean;
set showStartTitleButtons(val: boolean);
/**
* The tab view the overview controls.
*
* The view must be inside the tab overview, see [property`TabOverview:`child].
*/
get view(): TabView;
set view(val: TabView);
// Constructors
constructor(properties?: Partial<TabOverview.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): TabOverview;
// 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: 'create-tab', callback: (_source: this) => TabPage): number;
connect_after(signal: 'create-tab', callback: (_source: this) => TabPage): number;
emit(signal: 'create-tab'): void;
connect(
signal: 'extra-drag-drop',
callback: (_source: this, page: TabPage, value: GObject.Value) => boolean,
): number;
connect_after(
signal: 'extra-drag-drop',
callback: (_source: this, page: TabPage, value: GObject.Value) => boolean,
): number;
emit(signal: 'extra-drag-drop', page: TabPage, value: GObject.Value | any): void;
connect(
signal: 'extra-drag-value',
callback: (_source: this, page: TabPage, value: GObject.Value) => Gdk.DragAction,
): number;
connect_after(
signal: 'extra-drag-value',
callback: (_source: this, page: TabPage, value: GObject.Value) => Gdk.DragAction,
): number;
emit(signal: 'extra-drag-value', page: TabPage, value: GObject.Value | any): void;
// Methods
/**
* Gets the child widget of `self`.
* @returns the child widget of @self
*/
get_child(): Gtk.Widget | null;
/**
* Gets whether to new tab button is enabled for `self`.
* @returns whether new tab button is enabled
*/
get_enable_new_tab(): boolean;
/**
* Gets whether search in tabs is enabled for `self`.
* @returns whether search is enabled
*/
get_enable_search(): boolean;
/**
* Gets the current action during a drop on the extra_drop_target.
* @returns the drag action of the current drop.
*/
get_extra_drag_preferred_action(): Gdk.DragAction;
/**
* Gets whether drop data should be preloaded on hover.
* @returns whether drop data should be preloaded on hover
*/
get_extra_drag_preload(): boolean;
/**
* Gets whether thumbnails use inverted layout.
* @returns whether thumbnails use inverted layout
*/
get_inverted(): boolean;
/**
* Gets whether `self` is open.
* @returns whether the overview is open
*/
get_open(): boolean;
/**
* Gets whether search is currently active for `self`.
*
* See [property`TabOverview:`enable-search].
* @returns whether search is active
*/
get_search_active(): boolean;
/**
* Gets the secondary menu model for `self`.
* @returns the secondary menu model
*/
get_secondary_menu(): Gio.MenuModel | null;
/**
* Gets whether end title buttons are shown in `self'`s header bar.
* @returns whether end title buttons are shown
*/
get_show_end_title_buttons(): boolean;
/**
* Gets whether start title buttons are shown in `self'`s header bar.
* @returns whether start title buttons are shown
*/
get_show_start_title_buttons(): boolean;
/**
* Gets the tab view `self` controls.
* @returns the tab view
*/
get_view(): TabView | null;
/**
* Sets the child widget of `self`.
* @param child the child widget
*/
set_child(child?: Gtk.Widget | null): void;
/**
* Sets whether to enable new tab button for `self`.
*
* Connect to the [signal`TabOverview:`:create-tab] signal to use it.
* @param enable_new_tab whether to enable new tab button
*/
set_enable_new_tab(enable_new_tab: boolean): void;
/**
* Sets whether to enable search in tabs for `self`.
*
* Search matches tab titles and tooltips, as well as keywords, set via
* [property`TabPage:`keyword]. Use keywords to search in e.g. page URLs in a web
* browser.
*
* During search, tab reordering and drag-n-drop are disabled.
*
* Use [property`TabOverview:`search-active] to check out if search is currently
* active.
* @param enable_search whether to enable search
*/
set_enable_search(enable_search: boolean): void;
/**
* Sets whether drop data should be preloaded on hover.
*
* See [property`Gtk`.DropTarget:preload].
* @param preload whether to preload drop data
*/
set_extra_drag_preload(preload: boolean): void;
/**
* Sets whether thumbnails use inverted layout.
*
* If set to `TRUE`, thumbnails will have the close or unpin button at the
* beginning and the indicator at the end rather than the other way around.
* @param inverted whether thumbnails use inverted layout
*/
set_inverted(inverted: boolean): void;
/**
* Sets whether the to open `self`.
* @param open whether the overview is open
*/
set_open(open: boolean): void;
/**
* Sets the secondary menu model for `self`.
*
* Use it to add extra actions, e.g. to open a new window or undo closed tab.
* @param secondary_menu a menu model
*/
set_secondary_menu(secondary_menu?: Gio.MenuModel | null): void;
/**
* Sets whether to show end title buttons in `self'`s header bar.
*
* See [property`HeaderBar:`show-start-title-buttons] for the other side.
* @param show_end_title_buttons whether to show end title buttons
*/
set_show_end_title_buttons(show_end_title_buttons: boolean): void;
/**
* Sets whether to show start title buttons in `self'`s header bar.
*
* See [property`HeaderBar:`show-end-title-buttons] for the other side.
* @param show_start_title_buttons whether to show start title buttons
*/
set_show_start_title_buttons(show_start_title_buttons: boolean): void;
/**
* Sets the tab view to control.
*
* The view must be inside `self,` see [property`TabOverview:`child].
* @param view a tab view
*/
set_view(view?: TabView | null): void;
/**
* Sets the supported types for this drop target.
*
* Sets up an extra drop target on tabs.
*
* This allows to drag arbitrary content onto tabs, for example URLs in a web
* browser.
*
* If a tab is hovered for a certain period of time while dragging the content,
* it will be automatically selected.
*
* The [signal`TabOverview:`:extra-drag-drop] signal can be used to handle the
* drop.
* @param actions the supported actions
* @param types all supported `GType`s that can be dropped
*/
setup_extra_drop_target(actions: Gdk.DragAction | null, types?: GObject.GType[] | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 TabPage {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, Gtk.Accessible.ConstructorProps {
child: Gtk.Widget;
icon: Gio.Icon;
indicator_activatable: boolean;
indicatorActivatable: boolean;
indicator_icon: Gio.Icon;
indicatorIcon: Gio.Icon;
indicator_tooltip: string;
indicatorTooltip: string;
keyword: string;
live_thumbnail: boolean;
liveThumbnail: boolean;
loading: boolean;
needs_attention: boolean;
needsAttention: boolean;
parent: TabPage;
pinned: boolean;
selected: boolean;
thumbnail_xalign: number;
thumbnailXalign: number;
thumbnail_yalign: number;
thumbnailYalign: number;
title: string;
tooltip: string;
}
}
/**
* An auxiliary class used by [class`TabView]`.
*/
class TabPage extends GObject.Object implements Gtk.Accessible {
static $gtype: GObject.GType<TabPage>;
// Properties
/**
* The child of the page.
*/
get child(): Gtk.Widget;
/**
* The icon of the page.
*
* [class`TabBar]` and [class`TabOverview]` display the icon next to the title,
* unless [property`TabPage:`loading] is set to `TRUE`.
*
* `AdwTabBar` also won't show the icon if the page is pinned and
* [propertyTabPage:indicator-icon] is set.
*/
get icon(): Gio.Icon;
set icon(val: Gio.Icon);
/**
* Whether the indicator icon is activatable.
*
* If set to `TRUE`, [signal`TabView:`:indicator-activated] will be emitted
* when the indicator icon is clicked.
*
* If [property`TabPage:`indicator-icon] is not set, does nothing.
*/
get indicator_activatable(): boolean;
set indicator_activatable(val: boolean);
/**
* Whether the indicator icon is activatable.
*
* If set to `TRUE`, [signal`TabView:`:indicator-activated] will be emitted
* when the indicator icon is clicked.
*
* If [property`TabPage:`indicator-icon] is not set, does nothing.
*/
get indicatorActivatable(): boolean;
set indicatorActivatable(val: boolean);
/**
* An indicator icon for the page.
*
* A common use case is an audio or camera indicator in a web browser.
*
* [class`TabBar]` will show it at the beginning of the tab, alongside icon
* representing [property`TabPage:`icon] or loading spinner.
*
* If the page is pinned, the indicator will be shown instead of icon or
* spinner.
*
* [class`TabOverview]` will show it at the at the top part of the thumbnail.
*
* [property`TabPage:`indicator-tooltip] can be used to set the tooltip on the
* indicator icon.
*
* If [property`TabPage:`indicator-activatable] is set to `TRUE`, the
* indicator icon can act as a button.
*/
get indicator_icon(): Gio.Icon;
set indicator_icon(val: Gio.Icon);
/**
* An indicator icon for the page.
*
* A common use case is an audio or camera indicator in a web browser.
*
* [class`TabBar]` will show it at the beginning of the tab, alongside icon
* representing [property`TabPage:`icon] or loading spinner.
*
* If the page is pinned, the indicator will be shown instead of icon or
* spinner.
*
* [class`TabOverview]` will show it at the at the top part of the thumbnail.
*
* [property`TabPage:`indicator-tooltip] can be used to set the tooltip on the
* indicator icon.
*
* If [property`TabPage:`indicator-activatable] is set to `TRUE`, the
* indicator icon can act as a button.
*/
get indicatorIcon(): Gio.Icon;
set indicatorIcon(val: Gio.Icon);
/**
* The tooltip of the indicator icon.
*
* The tooltip can be marked up with the Pango text markup language.
*
* See [property`TabPage:`indicator-icon].
*/
get indicator_tooltip(): string;
set indicator_tooltip(val: string);
/**
* The tooltip of the indicator icon.
*
* The tooltip can be marked up with the Pango text markup language.
*
* See [property`TabPage:`indicator-icon].
*/
get indicatorTooltip(): string;
set indicatorTooltip(val: string);
/**
* The search keyboard of the page.
*
* [class`TabOverview]` can search pages by their keywords in addition to their
* titles and tooltips.
*
* Keywords allow to include e.g. page URLs into tab search in a web browser.
*/
get keyword(): string;
set keyword(val: string);
/**
* Whether to enable live thumbnail for this page.
*
* When set to `TRUE`, the page's thumbnail in [class`TabOverview]` will update
* immediately when the page is redrawn or resized.
*
* If it's set to `FALSE`, the thumbnail will only be live when the page is
* selected, and otherwise it will be static and will only update when
* [method`TabPage`.invalidate_thumbnail] or
* [method`TabView`.invalidate_thumbnails] is called.
*/
get live_thumbnail(): boolean;
set live_thumbnail(val: boolean);
/**
* Whether to enable live thumbnail for this page.
*
* When set to `TRUE`, the page's thumbnail in [class`TabOverview]` will update
* immediately when the page is redrawn or resized.
*
* If it's set to `FALSE`, the thumbnail will only be live when the page is
* selected, and otherwise it will be static and will only update when
* [method`TabPage`.invalidate_thumbnail] or
* [method`TabView`.invalidate_thumbnails] is called.
*/
get liveThumbnail(): boolean;
set liveThumbnail(val: boolean);
/**
* Whether the page is loading.
*
* If set to `TRUE`, [class`TabBar]` and [class`TabOverview]` will display a
* spinner in place of icon.
*
* If the page is pinned and [property`TabPage:`indicator-icon] is set,
* loading status will not be visible with `AdwTabBar`.
*/
get loading(): boolean;
set loading(val: boolean);
/**
* Whether the page needs attention.
*
* [class`TabBar]` will display a line under the tab representing the page if
* set to `TRUE`. If the tab is not visible, the corresponding edge of the tab
* bar will be highlighted.
*
* [class`TabOverview]` will display a dot in the corner of the thumbnail if set
* to `TRUE`.
*
* [class`TabButton]` will display a dot if any of the pages that aren't
* selected have this property set to `TRUE`.
*/
get needs_attention(): boolean;
set needs_attention(val: boolean);
/**
* Whether the page needs attention.
*
* [class`TabBar]` will display a line under the tab representing the page if
* set to `TRUE`. If the tab is not visible, the corresponding edge of the tab
* bar will be highlighted.
*
* [class`TabOverview]` will display a dot in the corner of the thumbnail if set
* to `TRUE`.
*
* [class`TabButton]` will display a dot if any of the pages that aren't
* selected have this property set to `TRUE`.
*/
get needsAttention(): boolean;
set needsAttention(val: boolean);
/**
* The parent page of the page.
*
* See [method`TabView`.add_page] and [method`TabView`.close_page].
*/
get parent(): TabPage;
/**
* Whether the page is pinned.
*
* See [method`TabView`.set_page_pinned].
*/
get pinned(): boolean;
/**
* Whether the page is selected.
*/
get selected(): boolean;
/**
* The horizontal alignment of the page thumbnail.
*
* If the page is so wide that [class`TabOverview]` can't display it completely
* and has to crop it, horizontal alignment will determine which part of the
* page will be visible.
*
* For example, 0.5 means the center of the page will be visible, 0 means the
* start edge will be visible and 1 means the end edge will be visible.
*
* The default horizontal alignment is 0.
*/
get thumbnail_xalign(): number;
set thumbnail_xalign(val: number);
/**
* The horizontal alignment of the page thumbnail.
*
* If the page is so wide that [class`TabOverview]` can't display it completely
* and has to crop it, horizontal alignment will determine which part of the
* page will be visible.
*
* For example, 0.5 means the center of the page will be visible, 0 means the
* start edge will be visible and 1 means the end edge will be visible.
*
* The default horizontal alignment is 0.
*/
get thumbnailXalign(): number;
set thumbnailXalign(val: number);
/**
* The vertical alignment of the page thumbnail.
*
* If the page is so tall that [class`TabOverview]` can't display it completely
* and has to crop it, vertical alignment will determine which part of the
* page will be visible.
*
* For example, 0.5 means the center of the page will be visible, 0 means the
* top edge will be visible and 1 means the bottom edge will be visible.
*
* The default vertical alignment is 0.
*/
get thumbnail_yalign(): number;
set thumbnail_yalign(val: number);
/**
* The vertical alignment of the page thumbnail.
*
* If the page is so tall that [class`TabOverview]` can't display it completely
* and has to crop it, vertical alignment will determine which part of the
* page will be visible.
*
* For example, 0.5 means the center of the page will be visible, 0 means the
* top edge will be visible and 1 means the bottom edge will be visible.
*
* The default vertical alignment is 0.
*/
get thumbnailYalign(): number;
set thumbnailYalign(val: number);
/**
* The title of the page.
*
* [class`TabBar]` will display it in the center of the tab unless it's pinned,
* and will use it as a tooltip unless [property`TabPage:`tooltip] is set.
*
* [class`TabOverview]` will display it below the thumbnail unless it's pinned,
* or inside the card otherwise, and will use it as a tooltip unless
* [property`TabPage:`tooltip] is set.
*/
get title(): string;
set title(val: string);
/**
* The tooltip of the page.
*
* The tooltip can be marked up with the Pango text markup language.
*
* If not set, [class`TabBar]` and [class`TabOverview]` will use
* [property`TabPage:`title] as a tooltip instead.
*/
get tooltip(): string;
set tooltip(val: string);
// Constructors
constructor(properties?: Partial<TabPage.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
// Methods
/**
* Gets the child of `self`.
* @returns the child of @self
*/
get_child(): Gtk.Widget;
/**
* Gets the icon of `self`.
* @returns the icon of @self
*/
get_icon(): Gio.Icon | null;
/**
* Gets whether the indicator of `self` is activatable.
* @returns whether the indicator is activatable
*/
get_indicator_activatable(): boolean;
/**
* Gets the indicator icon of `self`.
* @returns the indicator icon of @self
*/
get_indicator_icon(): Gio.Icon | null;
/**
* Gets the tooltip of the indicator icon of `self`.
* @returns the indicator tooltip of @self
*/
get_indicator_tooltip(): string;
/**
* Gets the search keyword of `self`.
* @returns the search keyword of @self
*/
get_keyword(): string | null;
/**
* Gets whether to live thumbnail is enabled `self`.
* @returns whether live thumbnail is enabled
*/
get_live_thumbnail(): boolean;
/**
* Gets whether `self` is loading.
* @returns whether @self is loading
*/
get_loading(): boolean;
/**
* Gets whether `self` needs attention.
* @returns whether @self needs attention
*/
get_needs_attention(): boolean;
/**
* Gets the parent page of `self`.
*
* See [method`TabView`.add_page] and [method`TabView`.close_page].
* @returns the parent page
*/
get_parent(): TabPage | null;
/**
* Gets whether `self` is pinned.
*
* See [method`TabView`.set_page_pinned].
* @returns whether @self is pinned
*/
get_pinned(): boolean;
/**
* Gets whether `self` is selected.
* @returns whether @self is selected
*/
get_selected(): boolean;
/**
* Gets the horizontal alignment of the thumbnail for `self`.
* @returns the horizontal alignment
*/
get_thumbnail_xalign(): number;
/**
* Gets the vertical alignment of the thumbnail for `self`.
* @returns the vertical alignment
*/
get_thumbnail_yalign(): number;
/**
* Gets the title of `self`.
* @returns the title of @self
*/
get_title(): string;
/**
* Gets the tooltip of `self`.
* @returns the tooltip of @self
*/
get_tooltip(): string | null;
/**
* Invalidates thumbnail for `self`.
*
* If an [class`TabOverview]` is open, the thumbnail representing `self` will be
* immediately updated. Otherwise it will be update when opening the overview.
*
* Does nothing if [property`TabPage:`live-thumbnail] is set to `TRUE`.
*
* See also [method`TabView`.invalidate_thumbnails].
*/
invalidate_thumbnail(): void;
/**
* Sets the icon of `self`.
*
* [class`TabBar]` and [class`TabOverview]` display the icon next to the title,
* unless [property`TabPage:`loading] is set to `TRUE`.
*
* `AdwTabBar` also won't show the icon if the page is pinned and
* [propertyTabPage:indicator-icon] is set.
* @param icon the icon of @self
*/
set_icon(icon?: Gio.Icon | null): void;
/**
* Sets whether the indicator of `self` is activatable.
*
* If set to `TRUE`, [signal`TabView:`:indicator-activated] will be emitted
* when the indicator icon is clicked.
*
* If [property`TabPage:`indicator-icon] is not set, does nothing.
* @param activatable whether the indicator is activatable
*/
set_indicator_activatable(activatable: boolean): void;
/**
* Sets the indicator icon of `self`.
*
* A common use case is an audio or camera indicator in a web browser.
*
* [class`TabBar]` will show it at the beginning of the tab, alongside icon
* representing [property`TabPage:`icon] or loading spinner.
*
* If the page is pinned, the indicator will be shown instead of icon or
* spinner.
*
* [class`TabOverview]` will show it at the at the top part of the thumbnail.
*
* [property`TabPage:`indicator-tooltip] can be used to set the tooltip on the
* indicator icon.
*
* If [property`TabPage:`indicator-activatable] is set to `TRUE`, the
* indicator icon can act as a button.
* @param indicator_icon the indicator icon of @self
*/
set_indicator_icon(indicator_icon?: Gio.Icon | null): void;
/**
* Sets the tooltip of the indicator icon of `self`.
*
* The tooltip can be marked up with the Pango text markup language.
*
* See [property`TabPage:`indicator-icon].
* @param tooltip the indicator tooltip of @self
*/
set_indicator_tooltip(tooltip: string): void;
/**
* Sets the search keyword for `self`.
*
* [class`TabOverview]` can search pages by their keywords in addition to their
* titles and tooltips.
*
* Keywords allow to include e.g. page URLs into tab search in a web browser.
* @param keyword the search keyword
*/
set_keyword(keyword: string): void;
/**
* Sets whether to enable live thumbnail for `self`.
*
* When set to `TRUE`, `self'`s thumbnail in [class`TabOverview]` will update
* immediately when `self` is redrawn or resized.
*
* If it's set to `FALSE`, the thumbnail will only be live when the `self` is
* selected, and otherwise it will be static and will only update when
* [method`TabPage`.invalidate_thumbnail] or
* [method`TabView`.invalidate_thumbnails] is called.
* @param live_thumbnail whether to enable live thumbnail
*/
set_live_thumbnail(live_thumbnail: boolean): void;
/**
* Sets whether `self` is loading.
*
* If set to `TRUE`, [class`TabBar]` and [class`TabOverview]` will display a
* spinner in place of icon.
*
* If the page is pinned and [property`TabPage:`indicator-icon] is set, loading
* status will not be visible with `AdwTabBar`.
* @param loading whether @self is loading
*/
set_loading(loading: boolean): void;
/**
* Sets whether `self` needs attention.
*
* [class`TabBar]` will display a line under the tab representing the page if
* set to `TRUE`. If the tab is not visible, the corresponding edge of the tab
* bar will be highlighted.
*
* [class`TabOverview]` will display a dot in the corner of the thumbnail if set
* to `TRUE`.
*
* [class`TabButton]` will display a dot if any of the pages that aren't
* selected have [property`TabPage:`needs-attention] set to `TRUE`.
* @param needs_attention whether @self needs attention
*/
set_needs_attention(needs_attention: boolean): void;
/**
* Sets the horizontal alignment of the thumbnail for `self`.
*
* If the page is so wide that [class`TabOverview]` can't display it completely
* and has to crop it, horizontal alignment will determine which part of the
* page will be visible.
*
* For example, 0.5 means the center of the page will be visible, 0 means the
* start edge will be visible and 1 means the end edge will be visible.
*
* The default horizontal alignment is 0.
* @param xalign the new value
*/
set_thumbnail_xalign(xalign: number): void;
/**
* Sets the vertical alignment of the thumbnail for `self`.
*
* If the page is so tall that [class`TabOverview]` can't display it completely
* and has to crop it, vertical alignment will determine which part of the page
* will be visible.
*
* For example, 0.5 means the center of the page will be visible, 0 means the
* top edge will be visible and 1 means the bottom edge will be visible.
*
* The default vertical alignment is 0.
* @param yalign the new value
*/
set_thumbnail_yalign(yalign: number): void;
/**
* [class`TabBar]` will display it in the center of the tab unless it's pinned,
* and will use it as a tooltip unless [property`TabPage:`tooltip] is set.
*
* [class`TabOverview]` will display it below the thumbnail unless it's pinned,
* or inside the card otherwise, and will use it as a tooltip unless
* [property`TabPage:`tooltip] is set.
*
* Sets the title of `self`.
* @param title the title of @self
*/
set_title(title: string): void;
/**
* Sets the tooltip of `self`.
*
* The tooltip can be marked up with the Pango text markup language.
*
* If not set, [class`TabBar]` and [class`TabOverview]` will use
* [property`TabPage:`title] as a tooltip instead.
* @param tooltip the tooltip of @self
*/
set_tooltip(tooltip: string): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* 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 TabView {
// Signal callback interfaces
interface ClosePage {
(page: TabPage): boolean;
}
interface CreateWindow {
(): TabView | null;
}
interface IndicatorActivated {
(page: TabPage): void;
}
interface PageAttached {
(page: TabPage, position: number): void;
}
interface PageDetached {
(page: TabPage, position: number): void;
}
interface PageReordered {
(page: TabPage, position: number): void;
}
interface SetupMenu {
(page?: TabPage | null): void;
}
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
default_icon: Gio.Icon;
defaultIcon: Gio.Icon;
is_transferring_page: boolean;
isTransferringPage: boolean;
menu_model: Gio.MenuModel;
menuModel: Gio.MenuModel;
n_pages: number;
nPages: number;
n_pinned_pages: number;
nPinnedPages: number;
pages: Gtk.SelectionModel;
selected_page: TabPage;
selectedPage: TabPage;
shortcuts: TabViewShortcuts;
}
}
/**
* A dynamic tabbed container.
*
* `AdwTabView` is a container which shows one child at a time. While it
* provides keyboard shortcuts for switching between pages, it does not provide
* a visible tab switcher and relies on external widgets for that, such as
* [class`TabBar]`, [class`TabOverview]` and [class`TabButton]`.
*
* `AdwTabView` maintains a [class`TabPage]` object for each page, which holds
* additional per-page properties. You can obtain the `AdwTabPage` for a page
* with [method`TabView`.get_page], and as the return value for
* [method`TabView`.append] and other functions for adding children.
*
* `AdwTabView` only aims to be useful for dynamic tabs in multi-window
* document-based applications, such as web browsers, file managers, text
* editors or terminals. It does not aim to replace [class`Gtk`.Notebook] for use
* cases such as tabbed dialogs.
*
* As such, it does not support disabling page reordering or detaching.
*
* `AdwTabView` adds a number of global page switching and reordering shortcuts.
* The [property`TabView:`shortcuts] property can be used to manage them.
*
* See [flags`TabViewShortcuts]` for the list of the available shortcuts. All of
* the shortcuts are enabled by default.
*
* [method`TabView`.add_shortcuts] and [method`TabView`.remove_shortcuts] can be
* used to manage shortcuts in a convenient way, for example:
*
* ```c
* adw_tab_view_remove_shortcuts (view, ADW_TAB_VIEW_SHORTCUT_CONTROL_HOME |
* ADW_TAB_VIEW_SHORTCUT_CONTROL_END);
* ```
*
* ## CSS nodes
*
* `AdwTabView` has a main CSS node with the name `tabview`.
*
* ## Accessibility
*
* `AdwTabView` uses the `GTK_ACCESSIBLE_ROLE_TAB_PANEL` for the tab pages which
* are the accessible parent objects of the child widgets.
*/
class TabView extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<TabView>;
// Properties
/**
* Default page icon.
*
* If a page doesn't provide its own icon via [property`TabPage:`icon], a
* default icon may be used instead for contexts where having an icon is
* necessary.
*
* [class`TabBar]` will use default icon for pinned tabs in case the page is
* not loading, doesn't have an icon and an indicator. Default icon is never
* used for tabs that aren't pinned.
*
* [class`TabOverview]` will use default icon for pages with missing
* thumbnails.
*
* By default, the `adw-tab-icon-missing-symbolic` icon is used.
*/
get default_icon(): Gio.Icon;
set default_icon(val: Gio.Icon);
/**
* Default page icon.
*
* If a page doesn't provide its own icon via [property`TabPage:`icon], a
* default icon may be used instead for contexts where having an icon is
* necessary.
*
* [class`TabBar]` will use default icon for pinned tabs in case the page is
* not loading, doesn't have an icon and an indicator. Default icon is never
* used for tabs that aren't pinned.
*
* [class`TabOverview]` will use default icon for pages with missing
* thumbnails.
*
* By default, the `adw-tab-icon-missing-symbolic` icon is used.
*/
get defaultIcon(): Gio.Icon;
set defaultIcon(val: Gio.Icon);
/**
* Whether a page is being transferred.
*
* This property will be set to `TRUE` when a drag-n-drop tab transfer starts
* on any `AdwTabView`, and to `FALSE` after it ends.
*
* During the transfer, children cannot receive pointer input and a tab can
* be safely dropped on the tab view.
*/
get is_transferring_page(): boolean;
/**
* Whether a page is being transferred.
*
* This property will be set to `TRUE` when a drag-n-drop tab transfer starts
* on any `AdwTabView`, and to `FALSE` after it ends.
*
* During the transfer, children cannot receive pointer input and a tab can
* be safely dropped on the tab view.
*/
get isTransferringPage(): boolean;
/**
* Tab context menu model.
*
* When a context menu is shown for a tab, it will be constructed from the
* provided menu model. Use the [signal`TabView:`:setup-menu] signal to set up
* the menu actions for the particular tab.
*/
get menu_model(): Gio.MenuModel;
set menu_model(val: Gio.MenuModel);
/**
* Tab context menu model.
*
* When a context menu is shown for a tab, it will be constructed from the
* provided menu model. Use the [signal`TabView:`:setup-menu] signal to set up
* the menu actions for the particular tab.
*/
get menuModel(): Gio.MenuModel;
set menuModel(val: Gio.MenuModel);
/**
* The number of pages in the tab view.
*/
get n_pages(): number;
/**
* The number of pages in the tab view.
*/
get nPages(): number;
/**
* The number of pinned pages in the tab view.
*
* See [method`TabView`.set_page_pinned].
*/
get n_pinned_pages(): number;
/**
* The number of pinned pages in the tab view.
*
* See [method`TabView`.set_page_pinned].
*/
get nPinnedPages(): number;
/**
* A selection model with the tab view's pages.
*
* This can be used to keep an up-to-date view. The model also implements
* [iface`Gtk`.SelectionModel] and can be used to track and change the selected
* page.
*/
get pages(): Gtk.SelectionModel;
/**
* The currently selected page.
*/
get selected_page(): TabPage;
set selected_page(val: TabPage);
/**
* The currently selected page.
*/
get selectedPage(): TabPage;
set selectedPage(val: TabPage);
/**
* The enabled shortcuts.
*
* See [flags`TabViewShortcuts]` for the list of the available shortcuts. All
* of the shortcuts are enabled by default.
*
* [method`TabView`.add_shortcuts] and [method`TabView`.remove_shortcuts]
* provide a convenient way to manage individual shortcuts.
*/
get shortcuts(): TabViewShortcuts;
set shortcuts(val: TabViewShortcuts);
// Constructors
constructor(properties?: Partial<TabView.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): TabView;
// 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: 'close-page', callback: (_source: this, page: TabPage) => boolean): number;
connect_after(signal: 'close-page', callback: (_source: this, page: TabPage) => boolean): number;
emit(signal: 'close-page', page: TabPage): void;
connect(signal: 'create-window', callback: (_source: this) => TabView | null): number;
connect_after(signal: 'create-window', callback: (_source: this) => TabView | null): number;
emit(signal: 'create-window'): void;
connect(signal: 'indicator-activated', callback: (_source: this, page: TabPage) => void): number;
connect_after(signal: 'indicator-activated', callback: (_source: this, page: TabPage) => void): number;
emit(signal: 'indicator-activated', page: TabPage): void;
connect(
signal: 'page-attached',
callback: (_source: this, page: TabPage, position: number) => void,
): number;
connect_after(
signal: 'page-attached',
callback: (_source: this, page: TabPage, position: number) => void,
): number;
emit(signal: 'page-attached', page: TabPage, position: number): void;
connect(
signal: 'page-detached',
callback: (_source: this, page: TabPage, position: number) => void,
): number;
connect_after(
signal: 'page-detached',
callback: (_source: this, page: TabPage, position: number) => void,
): number;
emit(signal: 'page-detached', page: TabPage, position: number): void;
connect(
signal: 'page-reordered',
callback: (_source: this, page: TabPage, position: number) => void,
): number;
connect_after(
signal: 'page-reordered',
callback: (_source: this, page: TabPage, position: number) => void,
): number;
emit(signal: 'page-reordered', page: TabPage, position: number): void;
connect(signal: 'setup-menu', callback: (_source: this, page: TabPage | null) => void): number;
connect_after(signal: 'setup-menu', callback: (_source: this, page: TabPage | null) => void): number;
emit(signal: 'setup-menu', page?: TabPage | null): void;
// Methods
/**
* Adds `child` to `self` with `parent` as the parent.
*
* This function can be used to automatically position new pages, and to select
* the correct page when this page is closed while being selected (see
* [method`TabView`.close_page]).
*
* If `parent` is `NULL`, this function is equivalent to [method`TabView`.append].
* @param child a widget to add
* @param parent a parent page for @child
* @returns the page object representing @child
*/
add_page(child: Gtk.Widget, parent?: TabPage | null): TabPage;
/**
* Adds `shortcuts` for `self`.
*
* See [property`TabView:`shortcuts] for details.
* @param shortcuts the shortcuts to add
*/
add_shortcuts(shortcuts: TabViewShortcuts | null): void;
/**
* Inserts `child` as the last non-pinned page.
* @param child a widget to add
* @returns the page object representing @child
*/
append(child: Gtk.Widget): TabPage;
/**
* Inserts `child` as the last pinned page.
* @param child a widget to add
* @returns the page object representing @child
*/
append_pinned(child: Gtk.Widget): TabPage;
/**
* Requests to close all pages other than `page`.
* @param page a page of @self
*/
close_other_pages(page: TabPage): void;
/**
* Requests to close `page`.
*
* Calling this function will result in the [signal`TabView:`:close-page] signal
* being emitted for `page`. Closing the page can then be confirmed or
* denied via [method`TabView`.close_page_finish].
*
* If the page is waiting for a [method`TabView`.close_page_finish] call, this
* function will do nothing.
*
* The default handler for [signal`TabView:`:close-page] will immediately confirm
* closing the page if it's non-pinned, or reject it if it's pinned. This
* behavior can be changed by registering your own handler for that signal.
*
* If `page` was selected, another page will be selected instead:
*
* If the [property`TabPage:`parent] value is `NULL`, the next page will be
* selected when possible, or if the page was already last, the previous page
* will be selected instead.
*
* If it's not `NULL`, the previous page will be selected if it's a descendant
* (possibly indirect) of the parent. If both the previous page and the parent
* are pinned, the parent will be selected instead.
* @param page a page of @self
*/
close_page(page: TabPage): void;
/**
* Completes a [method`TabView`.close_page] call for `page`.
*
* If `confirm` is `TRUE`, `page` will be closed. If it's `FALSE`, it will be
* reverted to its previous state and [method`TabView`.close_page] can be called
* for it again.
*
* This function should not be called unless a custom handler for
* [signal`TabView:`:close-page] is used.
* @param page a page of @self
* @param confirm whether to confirm or deny closing @page
*/
close_page_finish(page: TabPage, confirm: boolean): void;
/**
* Requests to close all pages after `page`.
* @param page a page of @self
*/
close_pages_after(page: TabPage): void;
/**
* Requests to close all pages before `page`.
* @param page a page of @self
*/
close_pages_before(page: TabPage): void;
/**
* Gets the default icon of `self`.
* @returns the default icon of @self.
*/
get_default_icon(): Gio.Icon;
/**
* Whether a page is being transferred.
*
* The corresponding property will be set to `TRUE` when a drag-n-drop tab
* transfer starts on any `AdwTabView`, and to `FALSE` after it ends.
*
* During the transfer, children cannot receive pointer input and a tab can
* be safely dropped on the tab view.
* @returns whether a page is being transferred
*/
get_is_transferring_page(): boolean;
/**
* Gets the tab context menu model for `self`.
* @returns the tab context menu model for @self
*/
get_menu_model(): Gio.MenuModel | null;
/**
* Gets the number of pages in `self`.
* @returns the number of pages in @self
*/
get_n_pages(): number;
/**
* Gets the number of pinned pages in `self`.
*
* See [method`TabView`.set_page_pinned].
* @returns the number of pinned pages in @self
*/
get_n_pinned_pages(): number;
/**
* Gets the [class`TabPage]` representing the child at `position`.
* @param position the index of the page in @self, starting from 0
* @returns the page object at @position
*/
get_nth_page(position: number): TabPage;
/**
* Gets the [class`TabPage]` object representing `child`.
* @param child a child in @self
* @returns the page object for @child
*/
get_page(child: Gtk.Widget): TabPage;
/**
* Finds the position of `page` in `self,` starting from 0.
* @param page a page of @self
* @returns the position of @page in @self
*/
get_page_position(page: TabPage): number;
/**
* Returns a [iface`Gio`.ListModel] that contains the pages of `self`.
*
* This can be used to keep an up-to-date view. The model also implements
* [iface`Gtk`.SelectionModel] and can be used to track and change the selected
* page.
* @returns a `GtkSelectionModel` for the pages of @self
*/
get_pages(): Gtk.SelectionModel;
/**
* Gets the currently selected page in `self`.
* @returns the selected page
*/
get_selected_page(): TabPage | null;
/**
* Gets the enabled shortcuts for `self`.
* @returns the shortcut mask
*/
get_shortcuts(): TabViewShortcuts;
/**
* Inserts a non-pinned page at `position`.
*
* It's an error to try to insert a page before a pinned page, in that case
* [method`TabView`.insert_pinned] should be used instead.
* @param child a widget to add
* @param position the position to add @child at, starting from 0
* @returns the page object representing @child
*/
insert(child: Gtk.Widget, position: number): TabPage;
/**
* Inserts a pinned page at `position`.
*
* It's an error to try to insert a pinned page after a non-pinned page, in
* that case [method`TabView`.insert] should be used instead.
* @param child a widget to add
* @param position the position to add @child at, starting from 0
* @returns the page object representing @child
*/
insert_pinned(child: Gtk.Widget, position: number): TabPage;
/**
* Invalidates thumbnails for all pages in `self`.
*
* This is a convenience method, equivalent to calling
* [method`TabPage`.invalidate_thumbnail] on each page.
*/
invalidate_thumbnails(): void;
/**
* Inserts `child` as the first non-pinned page.
* @param child a widget to add
* @returns the page object representing @child
*/
prepend(child: Gtk.Widget): TabPage;
/**
* Inserts `child` as the first pinned page.
* @param child a widget to add
* @returns the page object representing @child
*/
prepend_pinned(child: Gtk.Widget): TabPage;
/**
* Removes `shortcuts` from `self`.
*
* See [property`TabView:`shortcuts] for details.
* @param shortcuts the shortcuts to remove
*/
remove_shortcuts(shortcuts: TabViewShortcuts | null): void;
/**
* Reorders `page` to before its previous page if possible.
* @param page a page of @self
* @returns whether @page was moved
*/
reorder_backward(page: TabPage): boolean;
/**
* Reorders `page` to the first possible position.
* @param page a page of @self
* @returns whether @page was moved
*/
reorder_first(page: TabPage): boolean;
/**
* Reorders `page` to after its next page if possible.
* @param page a page of @self
* @returns whether @page was moved
*/
reorder_forward(page: TabPage): boolean;
/**
* Reorders `page` to the last possible position.
* @param page a page of @self
* @returns whether @page was moved
*/
reorder_last(page: TabPage): boolean;
/**
* Reorders `page` to `position`.
*
* It's a programmer error to try to reorder a pinned page after a non-pinned
* one, or a non-pinned page before a pinned one.
* @param page a page of @self
* @param position the position to insert the page at, starting at 0
* @returns whether @page was moved
*/
reorder_page(page: TabPage, position: number): boolean;
/**
* Selects the page after the currently selected page.
*
* If the last page was already selected, this function does nothing.
* @returns whether the selected page was changed
*/
select_next_page(): boolean;
/**
* Selects the page before the currently selected page.
*
* If the first page was already selected, this function does nothing.
* @returns whether the selected page was changed
*/
select_previous_page(): boolean;
/**
* Sets the default page icon for `self`.
*
* If a page doesn't provide its own icon via [property`TabPage:`icon], a default
* icon may be used instead for contexts where having an icon is necessary.
*
* [class`TabBar]` will use default icon for pinned tabs in case the page is not
* loading, doesn't have an icon and an indicator. Default icon is never used
* for tabs that aren't pinned.
*
* [class`TabOverview]` will use default icon for pages with missing thumbnails.
*
* By default, the `adw-tab-icon-missing-symbolic` icon is used.
* @param default_icon the default icon
*/
set_default_icon(default_icon: Gio.Icon): void;
/**
* Sets the tab context menu model for `self`.
*
* When a context menu is shown for a tab, it will be constructed from the
* provided menu model. Use the [signal`TabView:`:setup-menu] signal to set up
* the menu actions for the particular tab.
* @param menu_model a menu model
*/
set_menu_model(menu_model?: Gio.MenuModel | null): void;
/**
* Pins or unpins `page`.
*
* Pinned pages are guaranteed to be placed before all non-pinned pages; at any
* given moment the first [property`TabView:`n-pinned-pages] pages in `self` are
* guaranteed to be pinned.
*
* When a page is pinned or unpinned, it's automatically reordered: pinning a
* page moves it after other pinned pages; unpinning a page moves it before
* other non-pinned pages.
*
* Pinned pages can still be reordered between each other.
*
* [class`TabBar]` will display pinned pages in a compact form, never showing the
* title or close button, and only showing a single icon, selected in the
* following order:
*
* 1. [property`TabPage:`indicator-icon]
* 2. A spinner if [property`TabPage:`loading] is `TRUE`
* 3. [property`TabPage:`icon]
* 4. [property`TabView:`default-icon]
*
* [class`TabOverview]` will not show a thumbnail for pinned pages, and replace
* the close button with an unpin button. Unlike `AdwTabBar`, it will still
* display the page's title, icon and indicator separately.
*
* Pinned pages cannot be closed by default, see [signal`TabView:`:close-page]
* for how to override that behavior.
*
* Changes the value of the [property`TabPage:`pinned] property.
* @param page a page of @self
* @param pinned whether @page should be pinned
*/
set_page_pinned(page: TabPage, pinned: boolean): void;
/**
* Sets the currently selected page in `self`.
* @param selected_page a page in @self
*/
set_selected_page(selected_page: TabPage): void;
/**
* Sets the enabled shortcuts for `self`.
*
* See [flags`TabViewShortcuts]` for the list of the available shortcuts. All of
* the shortcuts are enabled by default.
*
* [method`TabView`.add_shortcuts] and [method`TabView`.remove_shortcuts] provide
* a convenient way to manage individual shortcuts.
* @param shortcuts the new shortcuts
*/
set_shortcuts(shortcuts: TabViewShortcuts | null): void;
/**
* Transfers `page` from `self` to `other_view`.
*
* The `page` object will be reused.
*
* It's a programmer error to try to insert a pinned page after a non-pinned
* one, or a non-pinned page before a pinned one.
* @param page a page of @self
* @param other_view the tab view to transfer the page to
* @param position the position to insert the page at, starting at 0
*/
transfer_page(page: TabPage, other_view: TabView, position: number): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 TimedAnimation {
// Constructor properties interface
interface ConstructorProps extends Animation.ConstructorProps {
alternate: boolean;
duration: number;
easing: Easing;
repeat_count: number;
repeatCount: number;
reverse: boolean;
value_from: number;
valueFrom: number;
value_to: number;
valueTo: number;
}
}
/**
* A time-based [class`Animation]`.
*
* `AdwTimedAnimation` implements a simple animation interpolating the given
* value from [property`TimedAnimation:`value-from] to
* [property`TimedAnimation:`value-to] over
* [property`TimedAnimation:`duration] milliseconds using the curve described by
* [property`TimedAnimation:`easing].
*
* If [property`TimedAnimation:`reverse] is set to `TRUE`, `AdwTimedAnimation`
* will instead animate from [property`TimedAnimation:`value-to] to
* [property`TimedAnimation:`value-from], and the easing curve will be inverted.
*
* The animation can repeat a certain amount of times, or endlessly, depending
* on the [property`TimedAnimation:`repeat-count] value. If
* [property`TimedAnimation:`alternate] is set to `TRUE`, it will also change the
* direction every other iteration.
*/
class TimedAnimation extends Animation {
static $gtype: GObject.GType<TimedAnimation>;
// Properties
/**
* Whether the animation changes direction on every iteration.
*/
get alternate(): boolean;
set alternate(val: boolean);
/**
* Duration of the animation, in milliseconds.
*
* Describes how much time the animation will take.
*
* If the animation repeats more than once, describes the duration of one
* iteration.
*/
get duration(): number;
set duration(val: number);
/**
* Easing function used in the animation.
*
* Describes the curve the value is interpolated on.
*
* See [enum`Easing]` for the description of specific easing functions.
*/
get easing(): Easing;
set easing(val: Easing);
/**
* Number of times the animation will play.
*
* If set to 0, the animation will repeat endlessly.
*/
get repeat_count(): number;
set repeat_count(val: number);
/**
* Number of times the animation will play.
*
* If set to 0, the animation will repeat endlessly.
*/
get repeatCount(): number;
set repeatCount(val: number);
/**
* Whether the animation plays backwards.
*/
get reverse(): boolean;
set reverse(val: boolean);
/**
* The value to animate from.
*
* The animation will start at this value and end at
* [property`TimedAnimation:`value-to].
*
* If [property`TimedAnimation:`reverse] is `TRUE`, the animation will end at
* this value instead.
*/
get value_from(): number;
set value_from(val: number);
/**
* The value to animate from.
*
* The animation will start at this value and end at
* [property`TimedAnimation:`value-to].
*
* If [property`TimedAnimation:`reverse] is `TRUE`, the animation will end at
* this value instead.
*/
get valueFrom(): number;
set valueFrom(val: number);
/**
* The value to animate to.
*
* The animation will start at [property`TimedAnimation:`value-from] and end at
* this value.
*
* If [property`TimedAnimation:`reverse] is `TRUE`, the animation will start
* at this value instead.
*/
get value_to(): number;
set value_to(val: number);
/**
* The value to animate to.
*
* The animation will start at [property`TimedAnimation:`value-from] and end at
* this value.
*
* If [property`TimedAnimation:`reverse] is `TRUE`, the animation will start
* at this value instead.
*/
get valueTo(): number;
set valueTo(val: number);
// Constructors
constructor(properties?: Partial<TimedAnimation.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](
widget: Gtk.Widget,
from: number,
to: number,
duration: number,
target: AnimationTarget,
): TimedAnimation;
// Methods
/**
* Gets whether `self` changes direction on every iteration.
* @returns whether @self alternates
*/
get_alternate(): boolean;
/**
* Gets the duration of `self`.
* @returns the duration of @self, in milliseconds
*/
get_duration(): number;
/**
* Gets the easing function `self` uses.
* @returns the easing function @self uses
*/
get_easing(): Easing;
/**
* Gets the number of times `self` will play.
* @returns the number of times @self will play
*/
get_repeat_count(): number;
/**
* Gets whether `self` plays backwards.
* @returns whether @self plays backwards
*/
get_reverse(): boolean;
/**
* Gets the value `self` will animate from.
* @returns the value to animate from
*/
get_value_from(): number;
/**
* Gets the value `self` will animate to.
* @returns the value to animate to
*/
get_value_to(): number;
/**
* Sets whether `self` changes direction on every iteration.
* @param alternate whether @self alternates
*/
set_alternate(alternate: boolean): void;
/**
* Sets the duration of `self`.
*
* If the animation repeats more than once, sets the duration of one iteration.
* @param duration the duration to use, in milliseconds
*/
set_duration(duration: number): void;
/**
* Sets the easing function `self` will use.
*
* See [enum`Easing]` for the description of specific easing functions.
* @param easing the easing function to use
*/
set_easing(easing: Easing | null): void;
/**
* Sets the number of times `self` will play.
*
* If set to 0, `self` will repeat endlessly.
* @param repeat_count the number of times @self will play
*/
set_repeat_count(repeat_count: number): void;
/**
* Sets whether `self` plays backwards.
* @param reverse whether @self plays backwards
*/
set_reverse(reverse: boolean): void;
/**
* Sets the value `self` will animate from.
*
* The animation will start at this value and end at
* [property`TimedAnimation:`value-to].
*
* If [property`TimedAnimation:`reverse] is `TRUE`, the animation will end at
* this value instead.
* @param value the value to animate from
*/
set_value_from(value: number): void;
/**
* Sets the value `self` will animate to.
*
* The animation will start at [property`TimedAnimation:`value-from] and end at
* this value.
*
* If [property`TimedAnimation:`reverse] is `TRUE`, the animation will start
* at this value instead.
* @param value the value to animate to
*/
set_value_to(value: number): void;
}
namespace Toast {
// Signal callback interfaces
interface ButtonClicked {
(): void;
}
interface Dismissed {
(): void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
action_name: string;
actionName: string;
action_target: GLib.Variant;
actionTarget: GLib.Variant;
button_label: string;
buttonLabel: string;
custom_title: Gtk.Widget;
customTitle: Gtk.Widget;
priority: ToastPriority;
timeout: number;
title: string;
use_markup: boolean;
useMarkup: boolean;
}
}
/**
* A helper object for [class`ToastOverlay]`.
*
* Toasts are meant to be passed into [method`ToastOverlay`.add_toast] as
* follows:
*
* ```c
* adw_toast_overlay_add_toast (overlay, adw_toast_new (_("Simple Toast")));
* ```
*
* <picture>
* <source srcset="toast-simple-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toast-simple.png" alt="toast-simple">
* </picture>
*
* Toasts always have a close button. They emit the [signal`Toast:`:dismissed]
* signal when disappearing.
*
* [property`Toast:`timeout] determines how long the toast stays on screen, while
* [property`Toast:`priority] determines how it behaves if another toast is
* already being displayed.
*
* Toast titles use Pango markup by default, set [property`Toast:`use-markup] to
* `FALSE` if this is unwanted.
*
* [property`Toast:`custom-title] can be used to replace the title label with a
* custom widget.
*
* ## Actions
*
* Toasts can have one button on them, with a label and an attached
* [iface`Gio`.Action].
*
* ```c
* AdwToast *toast = adw_toast_new (_("Toast with Action"));
*
* adw_toast_set_button_label (toast, _("_Example"));
* adw_toast_set_action_name (toast, "win.example");
*
* adw_toast_overlay_add_toast (overlay, toast);
* ```
*
* <picture>
* <source srcset="toast-action-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toast-action.png" alt="toast-action">
* </picture>
*
* ## Modifying toasts
*
* Toasts can be modified after they have been shown. For this, an `AdwToast`
* reference must be kept around while the toast is visible.
*
* A common use case for this is using toasts as undo prompts that stack with
* each other, allowing to batch undo the last deleted items:
*
* ```c
*
* static void
* toast_undo_cb (GtkWidget *sender,
* const char *action,
* GVariant *param)
* {
* // Undo the deletion
* }
*
* static void
* dismissed_cb (MyWindow *self)
* {
* self->undo_toast = NULL;
*
* // Permanently delete the items
* }
*
* static void
* delete_item (MyWindow *self,
* MyItem *item)
* {
* g_autofree char *title = NULL;
* int n_items;
*
* // Mark the item as waiting for deletion
* n_items = ... // The number of waiting items
*
* if (!self->undo_toast) {
* self->undo_toast = adw_toast_new_format (_("%s deleted"), ...);
*
* adw_toast_set_priority (self->undo_toast, ADW_TOAST_PRIORITY_HIGH);
* adw_toast_set_button_label (self->undo_toast, _("_Undo"));
* adw_toast_set_action_name (self->undo_toast, "toast.undo");
*
* g_signal_connect_swapped (self->undo_toast, "dismissed",
* G_CALLBACK (dismissed_cb), self);
*
* adw_toast_overlay_add_toast (self->toast_overlay, self->undo_toast);
*
* return;
* }
*
* title =
* g_strdup_printf (ngettext ("<span font_features='tnum=1'>%d</span> item deleted",
* "<span font_features='tnum=1'>%d</span> items deleted",
* n_items), n_items);
*
* adw_toast_set_title (self->undo_toast, title);
*
* // Bump the toast timeout
* adw_toast_overlay_add_toast (self->toast_overlay, g_object_ref (self->undo_toast));
* }
*
* static void
* my_window_class_init (MyWindowClass *klass)
* {
* GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
*
* gtk_widget_class_install_action (widget_class, "toast.undo", NULL, toast_undo_cb);
* }
* ```
*
* <picture>
* <source srcset="toast-undo-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toast-undo.png" alt="toast-undo">
* </picture>
*/
class Toast extends GObject.Object {
static $gtype: GObject.GType<Toast>;
// Properties
/**
* The name of the associated action.
*
* It will be activated when clicking the button.
*
* See [property`Toast:`action-target].
*/
get action_name(): string;
set action_name(val: string);
/**
* The name of the associated action.
*
* It will be activated when clicking the button.
*
* See [property`Toast:`action-target].
*/
get actionName(): string;
set actionName(val: string);
/**
* The parameter for action invocations.
*/
get action_target(): GLib.Variant;
set action_target(val: GLib.Variant);
/**
* The parameter for action invocations.
*/
get actionTarget(): GLib.Variant;
set actionTarget(val: GLib.Variant);
/**
* The label to show on the button.
*
* Underlines in the button text can be used to indicate a mnemonic.
*
* If set to `NULL`, the button won't be shown.
*
* See [property`Toast:`action-name].
*/
get button_label(): string;
set button_label(val: string);
/**
* The label to show on the button.
*
* Underlines in the button text can be used to indicate a mnemonic.
*
* If set to `NULL`, the button won't be shown.
*
* See [property`Toast:`action-name].
*/
get buttonLabel(): string;
set buttonLabel(val: string);
/**
* The custom title widget.
*
* It will be displayed instead of the title if set. In this case,
* [property`Toast:`title] is ignored.
*
* Setting a custom title will unset [property`Toast:`title].
*/
get custom_title(): Gtk.Widget;
set custom_title(val: Gtk.Widget);
/**
* The custom title widget.
*
* It will be displayed instead of the title if set. In this case,
* [property`Toast:`title] is ignored.
*
* Setting a custom title will unset [property`Toast:`title].
*/
get customTitle(): Gtk.Widget;
set customTitle(val: Gtk.Widget);
/**
* The priority of the toast.
*
* Priority controls how the toast behaves when another toast is already
* being displayed.
*
* If the priority is `ADW_TOAST_PRIORITY_NORMAL`, the toast will be queued.
*
* If the priority is `ADW_TOAST_PRIORITY_HIGH`, the toast will be displayed
* immediately, pushing the previous toast into the queue instead.
*/
get priority(): ToastPriority;
set priority(val: ToastPriority);
/**
* The timeout of the toast, in seconds.
*
* If timeout is 0, the toast is displayed indefinitely until manually
* dismissed.
*
* Toasts cannot disappear while being hovered, pressed (on touchscreen), or
* have keyboard focus inside them.
*/
get timeout(): number;
set timeout(val: number);
/**
* The title of the toast.
*
* The title can be marked up with the Pango text markup language.
*
* Setting a title will unset [property`Toast:`custom-title].
*
* If [property`Toast:`custom-title] is set, it will be used instead.
*/
get title(): string;
set title(val: string);
/**
* Whether to use Pango markup for the toast title.
*
* See also [func`Pango`.parse_markup].
*/
get use_markup(): boolean;
set use_markup(val: boolean);
/**
* Whether to use Pango markup for the toast title.
*
* See also [func`Pango`.parse_markup].
*/
get useMarkup(): boolean;
set useMarkup(val: boolean);
// Constructors
constructor(properties?: Partial<Toast.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](title: string): Toast;
// 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: 'button-clicked', callback: (_source: this) => void): number;
connect_after(signal: 'button-clicked', callback: (_source: this) => void): number;
emit(signal: 'button-clicked'): void;
connect(signal: 'dismissed', callback: (_source: this) => void): number;
connect_after(signal: 'dismissed', callback: (_source: this) => void): number;
emit(signal: 'dismissed'): void;
// Methods
/**
* Dismisses `self`.
*
* Does nothing if `self` has already been dismissed, or hasn't been added to an
* [class`ToastOverlay]`.
*/
dismiss(): void;
/**
* Gets the name of the associated action.
* @returns the action name
*/
get_action_name(): string | null;
/**
* Gets the parameter for action invocations.
* @returns the action target
*/
get_action_target_value(): GLib.Variant | null;
/**
* Gets the label to show on the button.
* @returns the button label
*/
get_button_label(): string | null;
/**
* Gets the custom title widget of `self`.
* @returns the custom title widget
*/
get_custom_title(): Gtk.Widget | null;
/**
* Gets priority for `self`.
* @returns the priority
*/
get_priority(): ToastPriority;
/**
* Gets timeout for `self`.
* @returns the timeout
*/
get_timeout(): number;
/**
* Gets the title that will be displayed on the toast.
*
* If a custom title has been set with [method`Adw`.Toast.set_custom_title]
* the return value will be %NULL.
* @returns the title
*/
get_title(): string | null;
/**
* Gets whether to use Pango markup for the toast title.
* @returns whether the toast uses markup
*/
get_use_markup(): boolean;
/**
* Sets the name of the associated action.
*
* It will be activated when clicking the button.
*
* See [property`Toast:`action-target].
* @param action_name the action name
*/
set_action_name(action_name?: string | null): void;
/**
* Sets the parameter for action invocations.
*
* If the `action_target` variant has a floating reference this function
* will sink it.
* @param action_target the action target
*/
set_action_target_value(action_target?: GLib.Variant | null): void;
/**
* Sets the label to show on the button.
*
* Underlines in the button text can be used to indicate a mnemonic.
*
* If set to `NULL`, the button won't be shown.
*
* See [property`Toast:`action-name].
* @param button_label a button label
*/
set_button_label(button_label?: string | null): void;
/**
* Sets the custom title widget of `self`.
*
* It will be displayed instead of the title if set. In this case,
* [property`Toast:`title] is ignored.
*
* Setting a custom title will unset [property`Toast:`title].
* @param widget the custom title widget
*/
set_custom_title(widget?: Gtk.Widget | null): void;
/**
* Sets the action name and its parameter.
*
* `detailed_action_name` is a string in the format accepted by
* [func`Gio`.Action.parse_detailed_name].
* @param detailed_action_name the detailed action name
*/
set_detailed_action_name(detailed_action_name?: string | null): void;
/**
* Sets priority for `self`.
*
* Priority controls how the toast behaves when another toast is already
* being displayed.
*
* If `priority` is `ADW_TOAST_PRIORITY_NORMAL`, the toast will be queued.
*
* If `priority` is `ADW_TOAST_PRIORITY_HIGH`, the toast will be displayed
* immediately, pushing the previous toast into the queue instead.
* @param priority the priority
*/
set_priority(priority: ToastPriority | null): void;
/**
* Sets timeout for `self`.
*
* If `timeout` is 0, the toast is displayed indefinitely until manually
* dismissed.
*
* Toasts cannot disappear while being hovered, pressed (on touchscreen), or
* have keyboard focus inside them.
* @param timeout the timeout
*/
set_timeout(timeout: number): void;
/**
* Sets the title that will be displayed on the toast.
*
* The title can be marked up with the Pango text markup language.
*
* Setting a title will unset [property`Toast:`custom-title].
*
* If [property`Toast:`custom-title] is set, it will be used instead.
* @param title a title
*/
set_title(title: string): void;
/**
* Whether to use Pango markup for the toast title.
*
* See also [func`Pango`.parse_markup].
* @param use_markup whether to use markup
*/
set_use_markup(use_markup: boolean): void;
}
namespace ToastOverlay {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
child: Gtk.Widget;
}
}
/**
* A widget showing toasts above its content.
*
* <picture>
* <source srcset="toast-overlay-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toast-overlay.png" alt="toast-overlay">
* </picture>
*
* Much like [class`Gtk`.Overlay], `AdwToastOverlay` is a container with a single
* main child, on top of which it can display a [class`Toast]`, overlaid.
* Toasts can be shown with [method`ToastOverlay`.add_toast].
*
* Use [method`ToastOverlay`.dismiss_all] to dismiss all toasts at once, or
* [method`Toast`.dismiss] to dismiss a single toast.
*
* See [class`Toast]` for details.
*
* ## CSS nodes
*
* ```
* toastoverlay
* ├── [child]
* ├── toast
* ┊ ├── widget
* ┊ │ ├── [label.heading]
* │ ╰── [custom title]
* ├── [button]
* ╰── button.circular.flat
* ```
*
* `AdwToastOverlay`'s CSS node is called `toastoverlay`. It contains the child,
* as well as zero or more `toast` subnodes.
*
* Each of the `toast` nodes contains a `widget` subnode, optionally a `button`
* subnode, and another `button` subnode with `.circular` and `.flat` style
* classes.
*
* The `widget` subnode contains a `label` subnode with the `.heading` style
* class, or a custom widget provided by the application.
*
* ## Accessibility
*
* `AdwToastOverlay` uses the `GTK_ACCESSIBLE_ROLE_TAB_GROUP` role.
*/
class ToastOverlay extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<ToastOverlay>;
// Properties
/**
* The child widget.
*/
get child(): Gtk.Widget;
set child(val: Gtk.Widget);
// Constructors
constructor(properties?: Partial<ToastOverlay.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): ToastOverlay;
// Methods
/**
* Displays `toast`.
*
* Only one toast can be shown at a time; if a toast is already being displayed,
* either `toast` or the original toast will be placed in a queue, depending on
* the priority of `toast`. See [property`Toast:`priority].
*
* If called on a toast that's already displayed, its timeout will be reset.
*
* If called on a toast currently in the queue, the toast will be bumped
* forward to be shown as soon as possible.
* @param toast a toast
*/
add_toast(toast: Toast): void;
/**
* Dismisses all displayed toasts.
*
* Use [method`Toast`.dismiss] to dismiss a single toast.
*/
dismiss_all(): void;
/**
* Gets the child widget of `self`.
* @returns the child widget of @self
*/
get_child(): Gtk.Widget | null;
/**
* Sets the child widget of `self`.
* @param child the child widget
*/
set_child(child?: Gtk.Widget | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 Toggle {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
child: Gtk.Widget;
enabled: boolean;
icon_name: string;
iconName: string;
label: string;
name: string;
tooltip: string;
use_underline: boolean;
useUnderline: boolean;
}
}
/**
* A toggle within [class`ToggleGroup]`.
*
* `AdwToggle` can optionally have a name, set with [property`Toggle:`name].
* If the name is set, [property`ToggleGroup:`active-name] can be used to access
* toggles instead of index.
*/
class Toggle extends GObject.Object {
static $gtype: GObject.GType<Toggle>;
// Properties
/**
* The toggle child.
*
* When the child is set, icon and label are not displayed.
*
* It's recommended to still set the label, as it can still be used by the
* screen reader.
*/
get child(): Gtk.Widget;
set child(val: Gtk.Widget);
/**
* Whether this toggle is enabled.
*/
get enabled(): boolean;
set enabled(val: boolean);
/**
* The toggle icon name.
*
* The icon will be displayed alone or next to the label, unless
* [property`Toggle:`child] is set.
*/
get icon_name(): string;
set icon_name(val: string);
/**
* The toggle icon name.
*
* The icon will be displayed alone or next to the label, unless
* [property`Toggle:`child] is set.
*/
get iconName(): string;
set iconName(val: string);
/**
* The toggle label.
*
* The label will be displayed alone or next to the icon, unless
* [property`Toggle:`child] is set, but will still be read out by the screen
* reader.
*/
get label(): string;
set label(val: string);
/**
* The toggle name.
*
* Allows accessing the toggle by its name instead of index.
*
* See [property`ToggleGroup:`active-name].
*/
get name(): string;
set name(val: string);
/**
* The tooltip of the toggle.
*
* The tooltip can be marked up with the Pango text markup language.
*/
get tooltip(): string;
set tooltip(val: string);
/**
* Whether an embedded underline in the label indicates a mnemonic.
*
* See [property`Toggle:`label].
*/
get use_underline(): boolean;
set use_underline(val: boolean);
/**
* Whether an embedded underline in the label indicates a mnemonic.
*
* See [property`Toggle:`label].
*/
get useUnderline(): boolean;
set useUnderline(val: boolean);
// Constructors
constructor(properties?: Partial<Toggle.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): Toggle;
// Methods
/**
* Gets the child widget of `self`.
* @returns the toggle child
*/
get_child(): Gtk.Widget | null;
/**
* Gets whether `self` is enabled.
* @returns whether the toggle is enabled
*/
get_enabled(): boolean;
/**
* Gets the icon name of `self`.
* @returns the toggle icon name
*/
get_icon_name(): string | null;
/**
* Gets the index of `self` within its toggle group.
* @returns the index, or `GTK_INVALID_LIST_POSITION` if it's not in a group
*/
get_index(): number;
/**
* Gets the label of `self`.
* @returns the toggle label
*/
get_label(): string | null;
/**
* Gets the name of `self`.
* @returns the toggle name
*/
get_name(): string;
/**
* Gets the tooltip of `self`.
* @returns the toggle tooltip
*/
get_tooltip(): string;
/**
* Gets whether `self` uses underlines.
* @returns whether the toggle uses underlines
*/
get_use_underline(): boolean;
/**
* Sets the child of `self` to `child`.
*
* When the child is set, icon and label are not displayed.
*
* It's recommended to still set the label, as it can still be used by the
* screen reader.
* @param child a child widget
*/
set_child(child?: Gtk.Widget | null): void;
/**
* Sets whether `self` is enabled.
* @param enabled whether the toggle should be enbled
*/
set_enabled(enabled: boolean): void;
/**
* Sets the icon name of `self` to `icon_name`.
*
* The icon will be displayed alone or next to the label, unless
* [property`Toggle:`child] is set.
* @param icon_name the icon name
*/
set_icon_name(icon_name?: string | null): void;
/**
* Sets the label of `self` to `label`.
*
* The label will be displayed alone or next to the icon, unless
* [property`Toggle:`child] is set, but will still be read out by the screen
* reader.
* @param label a label
*/
set_label(label?: string | null): void;
/**
* Sets the name of `self` to `name`.
*
* Allows accessing `self` by its name instead of index.
*
* See [property`ToggleGroup:`active-name].
* @param name a name
*/
set_name(name?: string | null): void;
/**
* Sets the tooltip of `self` to `tooltip`.
*
* `tooltip` can be marked up with the Pango text markup language.
* @param tooltip the tooltip
*/
set_tooltip(tooltip: string): void;
/**
* Sets whether an embedded underline in the label indicates a mnemonic.
*
* See [property`Toggle:`label].
* @param use_underline whether an underline in the label indicates a mnemonic
*/
set_use_underline(use_underline: boolean): void;
}
namespace ToggleGroup {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Orientable.ConstructorProps {
active: number;
active_name: string;
activeName: string;
can_shrink: boolean;
canShrink: boolean;
homogeneous: boolean;
n_toggles: number;
nToggles: number;
toggles: Gtk.SelectionModel;
}
}
/**
* A group of exclusive toggles.
*
* <picture>
* <source srcset="toggle-group-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toggle-group.png" alt="toggle-group">
* </picture>
*
* `AdwToggleGroup` presents a set of exclusive toggles, represented as
* [class`Toggle]` objects. Each toggle can display an icon, a label, an icon
* and a label, or a custom child.
*
* Toggles are indexed by their position, with the first toggle being equivalent
* to 0, and so on. Use the [property`ToggleGroup:`active] to get that position.
*
* Toggles can also have optional names, set via the [property`Toggle:`name]
* property. The name of the active toggle can be accessed via the
* [property`ToggleGroup:`active-name] property.
*
* `AdwToggle` objects can be retrieved via their index or name, using
* [method`ToggleGroup`.get_toggle] or [method`ToggleGroup`.get_toggle_by_name]
* respectively. `AdwToggleGroup` also provides a [iface`Gtk`.SelectionModel] of
* its toggles via the [property`ToggleGroup:`toggles] property.
*
* `AdwToggleGroup` is orientable, and the toggles can be displayed horizontally
* or vertically. This is mostly useful for icon-only toggles.
*
* Use the [property`ToggleGroup:`homogeneous] property to make the toggles take
* the same size, and the [property`ToggleGroup:`can-shrink] to control whether
* the toggles can ellipsize.
*
* Example of an `AdwToggleGroup` UI definition:
*
* ```xml
* <object class="AdwToggleGroup">
* <property name="active-name">picture</property>
* <child>
* <object class="AdwToggle">
* <property name="icon-name">camera-photo-symbolic</property>
* <property name="tooltip" translatable="yes">Picture Mode</property>
* <property name="name">picture</property>
* </object>
* </child>
* <child>
* <object class="AdwToggle">
* <property name="icon-name">camera-video-symbolic</property>
* <property name="tooltip" translatable="yes">Recording Mode</property>
* <property name="name">recording</property>
* </object>
* </child>
* </object>
* ```
*
* See also: [class`InlineViewSwitcher]`.
*
* ## CSS nodes
*
* `AdwToggleGroup` has a main CSS node with the name `toggle-group`.
*
* Its toggles have CSS nodes with the name `toggle`, and its separators have nodes
* with the name `separator`.
*
* Toggle nodes will have a different style classes depending on their content:
* `.text-button` for labels, `.image-button` for icons, `.image-text-button`
* for both or no style class for custom children.
*
* The hidden separators use the `.hidden` style class.
*
* ## Style classes
*
* `AdwToggleGroup` can use the [`.flat`](style-classes.html#flat_1) style class
* to remove its background and make it look like a group of buttons.
*
* <picture>
* <source srcset="toggle-group-flat-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toggle-group-flat.png" alt="toggle-group-flat">
* </picture>
*
* It can also use the [`.round`](style-classes.html#round) style class to make
* its toggles and the group itself rounded.
*
* <picture>
* <source srcset="toggle-group-round-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toggle-group-round.png" alt="toggle-group-round">
* </picture>
*
* They can also be combined with each other.
*
* <picture>
* <source srcset="toggle-group-flat-round-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toggle-group-flat-round.png" alt="toggle-group-flat-round">
* </picture>
*
* ## Accessibility
*
* `AdwToggleGroup` uses the `GTK_ACCESSIBLE_ROLE_RADIO_GROUP` role. Its toggles
* use the `GTK_ACCESSIBLE_ROLE_RADIO` role.
*/
class ToggleGroup
extends Gtk.Widget
implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Orientable
{
static $gtype: GObject.GType<ToggleGroup>;
// Properties
/**
* The index of the active toggle.
*
* Setting the index to a larger value than the number of toggles in the group
* unsets the current active toggle.
*
* If no toggle is active, the property will be set to
* [const`Gtk`.INVALID_LIST_POSITION].
*/
get active(): number;
set active(val: number);
/**
* The name of the active toggle.
*
* The name can be set via [property`Toggle:`name]. If the currently active
* toggle doesn't have a name, the property will be set to `NULL`.
*
* Set it to `NULL` to unset the current active toggle.
*/
get active_name(): string;
set active_name(val: string);
/**
* The name of the active toggle.
*
* The name can be set via [property`Toggle:`name]. If the currently active
* toggle doesn't have a name, the property will be set to `NULL`.
*
* Set it to `NULL` to unset the current active toggle.
*/
get activeName(): string;
set activeName(val: string);
/**
* Whether the toggles can be smaller than the natural size of their contents.
*
* If set to `TRUE`, the toggle labels will ellipsize.
*
* See [property`Gtk`.Button:can-shrink].
*/
get can_shrink(): boolean;
set can_shrink(val: boolean);
/**
* Whether the toggles can be smaller than the natural size of their contents.
*
* If set to `TRUE`, the toggle labels will ellipsize.
*
* See [property`Gtk`.Button:can-shrink].
*/
get canShrink(): boolean;
set canShrink(val: boolean);
/**
* Whether all toggles take the same size.
*/
get homogeneous(): boolean;
set homogeneous(val: boolean);
/**
* The number of toggles within the group.
*/
get n_toggles(): number;
/**
* The number of toggles within the group.
*/
get nToggles(): number;
/**
* A selection model with the groups's toggles.
*
* This can be used to keep an up-to-date view. The model also implements
* [iface`Gtk`.SelectionModel] and can be used to track and change the active
* toggle.
*/
get toggles(): Gtk.SelectionModel;
// Constructors
constructor(properties?: Partial<ToggleGroup.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): ToggleGroup;
// Methods
/**
* Adds a toggle to `self`.
* @param toggle the toggle to add
*/
add(toggle: Toggle): void;
/**
* Gets the index of the active toggle in `self`.
*
* Returns `GTK_INVALID_LIST_POSITION` if no toggle is active.
* @returns the active toggle index
*/
get_active(): number;
/**
* Gets the name of the active toggle in `self`.
*
* Can be `NULL` if the currently active toggle doesn't have a name.
*
* See [property`Toggle:`name].
* @returns the active toggle name
*/
get_active_name(): string | null;
/**
* Gets whether the toggles can be smaller than the natural size of their
* contents.
* @returns whether the toggles can shrink
*/
get_can_shrink(): boolean;
/**
* Gets whether all toggles take the same size.
* @returns whether all toggles take the same size
*/
get_homogeneous(): boolean;
/**
* Gets the number of toggles within `self`.
* @returns the number of toggles
*/
get_n_toggles(): number;
/**
* Gets the toggle with `index` from `self`.
* @param index toggle's index
* @returns the toggle
*/
get_toggle(index: number): Toggle | null;
/**
* Gets the toggle with the name `name` from `self`.
* @param name toggle name
* @returns the toggle
*/
get_toggle_by_name(name: string): Toggle | null;
/**
* Returns a [iface`Gio`.ListModel] that contains the toggles of the group.
*
* This can be used to keep an up-to-date view. The model also implements
* [iface`Gtk`.SelectionModel] and can be used to track and change the active
* toggle.
* @returns a `GtkSelectionModel` for the group's toggles
*/
get_toggles(): Gtk.SelectionModel;
/**
* Removes `toggle` from `self`.
* @param toggle a toggle to remove
*/
remove(toggle: Toggle): void;
/**
* Removes all toggles from `self`.
*/
remove_all(): void;
/**
* Sets the active toggle for `self`.
*
* If the index is larger than the number of toggles in `self,` unsets the
* current active toggle.
* @param active toggle index
*/
set_active(active: number): void;
/**
* Sets the active toggle for `self`.
*
* The name can be set via [property`Toggle:`name].
*
* If `name` is `NULL`, unset the current active toggle instead.
* @param name toggle name
*/
set_active_name(name?: string | null): void;
/**
* Sets whether the toggles can be smaller than the natural size of their
* contents.
*
* If `can_shrink` is `TRUE`, the toggle labels will ellipsize.
*
* See [property`Gtk`.Button:can-shrink].
* @param can_shrink whether the toggles can shrink
*/
set_can_shrink(can_shrink: boolean): void;
/**
* Sets whether all toggles take the same size.
* @param homogeneous whether all toggles should take the same size
*/
set_homogeneous(homogeneous: boolean): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* The orientation of the orientable.
*/
get orientation(): Gtk.Orientation;
set orientation(val: Gtk.Orientation);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: string): void;
/**
* Retrieves the orientation of the `orientable`.
* @returns the orientation of the @orientable
*/
get_orientation(): Gtk.Orientation;
/**
* Sets the orientation of the `orientable`.
* @param orientation the orientables new orientation
*/
set_orientation(orientation: Gtk.Orientation | null): 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 ToolbarView {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
bottom_bar_height: number;
bottomBarHeight: number;
bottom_bar_style: ToolbarStyle;
bottomBarStyle: ToolbarStyle;
content: Gtk.Widget;
extend_content_to_bottom_edge: boolean;
extendContentToBottomEdge: boolean;
extend_content_to_top_edge: boolean;
extendContentToTopEdge: boolean;
reveal_bottom_bars: boolean;
revealBottomBars: boolean;
reveal_top_bars: boolean;
revealTopBars: boolean;
top_bar_height: number;
topBarHeight: number;
top_bar_style: ToolbarStyle;
topBarStyle: ToolbarStyle;
}
}
/**
* A widget containing a page, as well as top and/or bottom bars.
*
* <picture>
* <source srcset="toolbar-view-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toolbar-view.png" alt="toolbar-view">
* </picture>
*
* `AdwToolbarView` has a single content widget and one or multiple top and
* bottom bars, shown at the top and bottom sides respectively.
*
* Example of an `AdwToolbarView` UI definition:
* ```xml
* <object class="AdwToolbarView">
* <child type="top">
* <object class="AdwHeaderBar"/>
* </child>
* <property name="content">
* <object class="AdwPreferencesPage">
* <!-- ... -->
* </object>
* </property>
* </object>
* ```
*
* The following kinds of top and bottom bars are supported:
*
* - [class`HeaderBar]`
* - [class`TabBar]`
* - [class`ViewSwitcherBar]`
* - [class`Gtk`.ActionBar]
* - [class`Gtk`.HeaderBar]
* - [class`Gtk`.PopoverMenuBar]
* - [class`Gtk`.SearchBar]
* - Any [class`Gtk`.Box] or a similar widget with the
* [`.toolbar`](style-classes.html#toolbars) style class
*
* By default, top and bottom bars are flat and scrolling content has a subtle
* undershoot shadow, same as when using the
* [`.undershoot-top`](style-classes.html#undershoot-indicators) and
* [`.undershoot-bottom`](style-classes.html#undershoot-indicators) style
* classes. This works well in most cases, e.g. with [class`StatusPage]` or
* [class`PreferencesPage]`, where the background at the top and bottom parts of
* the page is uniform. Additionally, windows with sidebars should always use
* this style.
*
* [property`ToolbarView:`top-bar-style] and
* [property`ToolbarView:`bottom-bar-style] properties can be used add an opaque
* background and a persistent shadow to top and bottom bars, this can be useful
* for content such as [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
* where some elements are adjacent to the top/bottom bars, or [class`TabView]`,
* where each page can have a different background.
*
* <picture style="min-width: 33%; display: inline-block;">
* <source srcset="toolbar-view-flat-1-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toolbar-view-flat-1.png" alt="toolbar-view-flat-1">
* </picture>
* <picture style="min-width: 33%; display: inline-block;">
* <source srcset="toolbar-view-flat-2-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toolbar-view-flat-2.png" alt="toolbar-view-flat-2">
* </picture>
* <picture style="min-width: 33%; display: inline-block;">
* <source srcset="toolbar-view-raised-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toolbar-view-raised.png" alt="toolbar-view-raised">
* </picture>
*
* `AdwToolbarView` ensures the top and bottom bars have consistent backdrop
* styles and vertical spacing. For comparison:
*
* <picture style="min-width: 40%; display: inline-block;">
* <source srcset="toolbar-view-spacing-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toolbar-view-spacing.png" alt="toolbar-view-spacing">
* </picture>
* <picture style="min-width: 40%; display: inline-block;">
* <source srcset="toolbar-view-spacing-box-dark.png" media="(prefers-color-scheme: dark)">
* <img src="toolbar-view-spacing-box.png" alt="toolbar-view-spacing-box">
* </picture>
*
* Any top and bottom bars can also be dragged to move the window, equivalent
* to putting them into a [class`Gtk`.WindowHandle].
*
* Content is typically place between top and bottom bars, but can also extend
* behind them. This is controlled with the
* [property`ToolbarView:`extend-content-to-top-edge] and
* [property`ToolbarView:`extend-content-to-bottom-edge] properties.
*
* Top and bottom bars can be hidden and revealed with an animation using the
* [property`ToolbarView:`reveal-top-bars] and
* [property`ToolbarView:`reveal-bottom-bars] properties.
*
* ## `AdwToolbarView` as `GtkBuildable`
*
* The `AdwToolbarView` implementation of the [iface`Gtk`.Buildable] interface
* supports adding a top bar by specifying “top” as the “type” attribute of a
* `<child>` element, or adding a bottom bar by specifying “bottom”.
*
* ## Accessibility
*
* `AdwToolbarView` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.
*/
class ToolbarView extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<ToolbarView>;
// Properties
/**
* The current bottom bar height.
*
* Bottom bar height does change depending on
* [property`ToolbarView:`reveal-bottom-bars], including during the transition.
*
* See [property`ToolbarView:`top-bar-height].
*/
get bottom_bar_height(): number;
/**
* The current bottom bar height.
*
* Bottom bar height does change depending on
* [property`ToolbarView:`reveal-bottom-bars], including during the transition.
*
* See [property`ToolbarView:`top-bar-height].
*/
get bottomBarHeight(): number;
/**
* Appearance of the bottom bars.
*
* If set to `ADW_TOOLBAR_FLAT`, bottom bars are flat and scrolling content
* has a subtle undershoot shadow when touching them, same as the
* [`.undershoot-bottom`](style-classes.html#undershoot-indicators)
* style class. This works well for simple content, e.g. [class`StatusPage]` or
* [class`PreferencesPage]`, where the background at the bottom of the page is
* uniform. Additionally, windows with sidebars should always use this style.
*
* Undershoot shadow is only present if a bottom bar is actually present and
* visible. It is also never present if
* [property`ToolbarView:`extend-content-to-bottom-edge] is set to `TRUE`.
*
* If set to `ADW_TOOLBAR_RAISED`, bottom bars have an opaque background and a
* persistent shadow, this is suitable for content such as
* [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
* where some elements are directly adjacent to the bottom bars, or
* [class`TabView]`, where each page can have a different background.
*
* `ADW_TOOLBAR_RAISED_BORDER` is similar to `ADW_TOOLBAR_RAISED`, but the
* shadow is replaced with a more subtle border. This can be useful for
* applications like image viewers.
*
* See also [property`ToolbarView:`top-bar-style].
*/
get bottom_bar_style(): ToolbarStyle;
set bottom_bar_style(val: ToolbarStyle);
/**
* Appearance of the bottom bars.
*
* If set to `ADW_TOOLBAR_FLAT`, bottom bars are flat and scrolling content
* has a subtle undershoot shadow when touching them, same as the
* [`.undershoot-bottom`](style-classes.html#undershoot-indicators)
* style class. This works well for simple content, e.g. [class`StatusPage]` or
* [class`PreferencesPage]`, where the background at the bottom of the page is
* uniform. Additionally, windows with sidebars should always use this style.
*
* Undershoot shadow is only present if a bottom bar is actually present and
* visible. It is also never present if
* [property`ToolbarView:`extend-content-to-bottom-edge] is set to `TRUE`.
*
* If set to `ADW_TOOLBAR_RAISED`, bottom bars have an opaque background and a
* persistent shadow, this is suitable for content such as
* [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
* where some elements are directly adjacent to the bottom bars, or
* [class`TabView]`, where each page can have a different background.
*
* `ADW_TOOLBAR_RAISED_BORDER` is similar to `ADW_TOOLBAR_RAISED`, but the
* shadow is replaced with a more subtle border. This can be useful for
* applications like image viewers.
*
* See also [property`ToolbarView:`top-bar-style].
*/
get bottomBarStyle(): ToolbarStyle;
set bottomBarStyle(val: ToolbarStyle);
/**
* The content widget.
*/
get content(): Gtk.Widget;
set content(val: Gtk.Widget);
/**
* Whether the content widget can extend behind bottom bars.
*
* This can be used in combination with
* [property`ToolbarView:`reveal-bottom-bars] to show and hide toolbars in
* fullscreen.
*
* See [property`ToolbarView:`extend-content-to-top-edge].
*/
get extend_content_to_bottom_edge(): boolean;
set extend_content_to_bottom_edge(val: boolean);
/**
* Whether the content widget can extend behind bottom bars.
*
* This can be used in combination with
* [property`ToolbarView:`reveal-bottom-bars] to show and hide toolbars in
* fullscreen.
*
* See [property`ToolbarView:`extend-content-to-top-edge].
*/
get extendContentToBottomEdge(): boolean;
set extendContentToBottomEdge(val: boolean);
/**
* Whether the content widget can extend behind top bars.
*
* This can be used in combination with [property`ToolbarView:`reveal-top-bars]
* to show and hide toolbars in fullscreen.
*
* See [property`ToolbarView:`extend-content-to-bottom-edge].
*/
get extend_content_to_top_edge(): boolean;
set extend_content_to_top_edge(val: boolean);
/**
* Whether the content widget can extend behind top bars.
*
* This can be used in combination with [property`ToolbarView:`reveal-top-bars]
* to show and hide toolbars in fullscreen.
*
* See [property`ToolbarView:`extend-content-to-bottom-edge].
*/
get extendContentToTopEdge(): boolean;
set extendContentToTopEdge(val: boolean);
/**
* Whether bottom bars are visible.
*
* The transition will be animated.
*
* This can be used in combination with
* [property`ToolbarView:`extend-content-to-bottom-edge] to show and hide
* toolbars in fullscreen.
*
* See [property`ToolbarView:`reveal-top-bars].
*/
get reveal_bottom_bars(): boolean;
set reveal_bottom_bars(val: boolean);
/**
* Whether bottom bars are visible.
*
* The transition will be animated.
*
* This can be used in combination with
* [property`ToolbarView:`extend-content-to-bottom-edge] to show and hide
* toolbars in fullscreen.
*
* See [property`ToolbarView:`reveal-top-bars].
*/
get revealBottomBars(): boolean;
set revealBottomBars(val: boolean);
/**
* Whether top bars are revealed.
*
* The transition will be animated.
*
* This can be used in combination with
* [property`ToolbarView:`extend-content-to-top-edge] to show and hide toolbars
* in fullscreen.
*
* See [property`ToolbarView:`reveal-bottom-bars].
*/
get reveal_top_bars(): boolean;
set reveal_top_bars(val: boolean);
/**
* Whether top bars are revealed.
*
* The transition will be animated.
*
* This can be used in combination with
* [property`ToolbarView:`extend-content-to-top-edge] to show and hide toolbars
* in fullscreen.
*
* See [property`ToolbarView:`reveal-bottom-bars].
*/
get revealTopBars(): boolean;
set revealTopBars(val: boolean);
/**
* The current top bar height.
*
* Top bar height does change depending [property`ToolbarView:`reveal-top-bars],
* including during the transition.
*
* See [property`ToolbarView:`bottom-bar-height].
*/
get top_bar_height(): number;
/**
* The current top bar height.
*
* Top bar height does change depending [property`ToolbarView:`reveal-top-bars],
* including during the transition.
*
* See [property`ToolbarView:`bottom-bar-height].
*/
get topBarHeight(): number;
/**
* Appearance of the top bars.
*
* If set to `ADW_TOOLBAR_FLAT`, top bars are flat and scrolling content has a
* subtle undershoot shadow when touching them, same as the
* [`.undershoot-top`](style-classes.html#undershoot-indicators)
* style class. This works well for simple content, e.g. [class`StatusPage]` or
* [class`PreferencesPage]`, where the background at the top of the page is
* uniform. Additionally, windows with sidebars should always use this style.
*
* Undershoot shadow is only present if a top bar is actually present and
* visible. It is also never present if
* [property`ToolbarView:`extend-content-to-top-edge] is set to `TRUE`.
*
* If set to `ADW_TOOLBAR_RAISED`, top bars have an opaque background and a
* persistent shadow, this is suitable for content such as
* [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
* where some elements are directly adjacent to the top bars, or
* [class`TabView]`, where each page can have a different background.
*
* `ADW_TOOLBAR_RAISED_BORDER` is similar to `ADW_TOOLBAR_RAISED`, but the
* shadow is replaced with a more subtle border. This can be useful for
* applications like image viewers.
*
* See also [property`ToolbarView:`bottom-bar-style].
*/
get top_bar_style(): ToolbarStyle;
set top_bar_style(val: ToolbarStyle);
/**
* Appearance of the top bars.
*
* If set to `ADW_TOOLBAR_FLAT`, top bars are flat and scrolling content has a
* subtle undershoot shadow when touching them, same as the
* [`.undershoot-top`](style-classes.html#undershoot-indicators)
* style class. This works well for simple content, e.g. [class`StatusPage]` or
* [class`PreferencesPage]`, where the background at the top of the page is
* uniform. Additionally, windows with sidebars should always use this style.
*
* Undershoot shadow is only present if a top bar is actually present and
* visible. It is also never present if
* [property`ToolbarView:`extend-content-to-top-edge] is set to `TRUE`.
*
* If set to `ADW_TOOLBAR_RAISED`, top bars have an opaque background and a
* persistent shadow, this is suitable for content such as
* [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
* where some elements are directly adjacent to the top bars, or
* [class`TabView]`, where each page can have a different background.
*
* `ADW_TOOLBAR_RAISED_BORDER` is similar to `ADW_TOOLBAR_RAISED`, but the
* shadow is replaced with a more subtle border. This can be useful for
* applications like image viewers.
*
* See also [property`ToolbarView:`bottom-bar-style].
*/
get topBarStyle(): ToolbarStyle;
set topBarStyle(val: ToolbarStyle);
// Constructors
constructor(properties?: Partial<ToolbarView.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): ToolbarView;
// Methods
/**
* Adds a bottom bar to `self`.
* @param widget a widget
*/
add_bottom_bar(widget: Gtk.Widget): void;
/**
* Adds a top bar to `self`.
* @param widget a widget
*/
add_top_bar(widget: Gtk.Widget): void;
/**
* Gets the current bottom bar height for `self`.
*
* Bottom bar height does change depending on
* [property`ToolbarView:`reveal-bottom-bars], including during the transition.
*
* See [method`ToolbarView`.get_top_bar_height].
* @returns the current bottom bar height
*/
get_bottom_bar_height(): number;
/**
* Gets appearance of the bottom bars for `self`.
* @returns bottom bar style
*/
get_bottom_bar_style(): ToolbarStyle;
/**
* Gets the content widget for `self`.
* @returns the content widget
*/
get_content(): Gtk.Widget | null;
/**
* Gets whether the content widget can extend behind bottom bars.
* @returns whether content extends behind bottom bars
*/
get_extend_content_to_bottom_edge(): boolean;
/**
* Gets whether the content widget can extend behind top bars.
* @returns whether content extends behind top bars
*/
get_extend_content_to_top_edge(): boolean;
/**
* Gets whether bottom bars are revealed for `self`.
* @returns whether bottom bars are revealed
*/
get_reveal_bottom_bars(): boolean;
/**
* Gets whether top bars are revealed for `self`.
* @returns whether top bars are revealed
*/
get_reveal_top_bars(): boolean;
/**
* Gets the current top bar height for `self`.
*
* Top bar height does change depending on
* [property`ToolbarView:`reveal-top-bars], including during the transition.
*
* See [method`ToolbarView`.get_bottom_bar_height].
* @returns the current top bar height
*/
get_top_bar_height(): number;
/**
* Gets appearance of the top bars for `self`.
* @returns top bar style
*/
get_top_bar_style(): ToolbarStyle;
/**
* Removes a child from `self`.
* @param widget the child to be removed
*/
remove(widget: Gtk.Widget): void;
/**
* Sets appearance of the bottom bars for `self`.
*
* If set to `ADW_TOOLBAR_FLAT`, bottom bars are flat and scrolling content has
* a subtle undershoot shadow when touching them, same as the
* [`.undershoot-bottom`](style-classes.html#undershoot-indicators)
* style class. This works well for simple content, e.g. [class`StatusPage]` or
* [class`PreferencesPage]`, where the background at the bottom of the page is
* uniform. Additionally, windows with sidebars should always use this style.
*
* Undershoot shadow is only present if a bottom bar is actually present and
* visible. It is also never present if
* [property`ToolbarView:`extend-content-to-bottom-edge] is set to `TRUE`.
*
* If set to `ADW_TOOLBAR_RAISED`, bottom bars have an opaque background and a
* persistent shadow, this is suitable for content such as
* [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
* where some elements are directly adjacent to the bottom bars, or
* [class`TabView]`, where each page can have a different background.
*
* `ADW_TOOLBAR_RAISED_BORDER` is similar to `ADW_TOOLBAR_RAISED`, but the
* shadow is replaced with a more subtle border. This can be useful for
* applications like image viewers.
*
* See also [method`ToolbarView`.set_top_bar_style].
* @param style bottom bar style
*/
set_bottom_bar_style(style: ToolbarStyle | null): void;
/**
* Sets the content widget for `self`.
* @param content the content widget
*/
set_content(content?: Gtk.Widget | null): void;
/**
* Sets whether the content widget can extend behind bottom bars.
*
* This can be used in combination with [property`ToolbarView:`reveal-bottom-bars]
* to show and hide toolbars in fullscreen.
*
* See [method`ToolbarView`.set_extend_content_to_top_edge].
* @param extend whether content extends behind bottom bars
*/
set_extend_content_to_bottom_edge(extend: boolean): void;
/**
* Sets whether the content widget can extend behind top bars.
*
* This can be used in combination with [property`ToolbarView:`reveal-top-bars]
* to show and hide toolbars in fullscreen.
*
* See [method`ToolbarView`.set_extend_content_to_bottom_edge].
* @param extend whether content extends behind top bars
*/
set_extend_content_to_top_edge(extend: boolean): void;
/**
* Sets whether bottom bars are revealed for `self`.
*
* The transition will be animated.
*
* This can be used in combination with
* [property`ToolbarView:`extend-content-to-bottom-edge] to show and hide
* toolbars in fullscreen.
*
* See [method`ToolbarView`.set_reveal_top_bars].
* @param reveal whether to reveal bottom bars
*/
set_reveal_bottom_bars(reveal: boolean): void;
/**
* Sets whether top bars are revealed for `self`.
*
* The transition will be animated.
*
* This can be used in combination with
* [property`ToolbarView:`extend-content-to-top-edge] to show and hide toolbars
* in fullscreen.
*
* See [method`ToolbarView`.set_reveal_bottom_bars].
* @param reveal whether to reveal top bars
*/
set_reveal_top_bars(reveal: boolean): void;
/**
* Sets appearance of the top bars for `self`.
*
* If set to `ADW_TOOLBAR_FLAT`, top bars are flat and scrolling content has a
* subtle undershoot shadow when touching them, same as the
* [`.undershoot-top`](style-classes.html#undershoot-indicators)
* style class. This works well for simple content, e.g. [class`StatusPage]` or
* [class`PreferencesPage]`, where the background at the top of the page is
* uniform. Additionally, windows with sidebars should always use this style.
*
* Undershoot shadow is only present if a top bar is actually present and
* visible. It is also never present if
* [property`ToolbarView:`extend-content-to-top-edge] is set to `TRUE`.
*
* If set to `ADW_TOOLBAR_RAISED`, top bars have an opaque background and a
* persistent shadow, this is suitable for content such as
* [utility panes](https://developer.gnome.org/hig/patterns/containers/utility-panes.html),
* where some elements are directly adjacent to the top bars, or
* [class`TabView]`, where each page can have a different background.
*
* `ADW_TOOLBAR_RAISED_BORDER` is similar to `ADW_TOOLBAR_RAISED`, but the
* shadow is replaced with a more subtle border. This can be useful for
* applications like image viewers.
*
* See also [method`ToolbarView`.set_bottom_bar_style].
* @param style top bar style
*/
set_top_bar_style(style: ToolbarStyle | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 ViewStack {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
enable_transitions: boolean;
enableTransitions: boolean;
hhomogeneous: boolean;
pages: Gtk.SelectionModel;
transition_duration: number;
transitionDuration: number;
transition_running: boolean;
transitionRunning: boolean;
vhomogeneous: boolean;
visible_child: Gtk.Widget;
visibleChild: Gtk.Widget;
visible_child_name: string;
visibleChildName: string;
}
}
/**
* A view container for [class`ViewSwitcher]`.
*
* `AdwViewStack` is a container which only shows one page at a time.
* It is typically used to hold an application's main views.
*
* It doesn't provide a way to transition between pages.
* Instead, a separate widget such as [class`ViewSwitcher]` can be used with
* `AdwViewStack` to provide this functionality.
*
* `AdwViewStack` pages can have a title, an icon, an attention request, and a
* numbered badge that [class`ViewSwitcher]` will use to let users identify which
* page is which. Set them using the [property`ViewStackPage:`title],
* [property`ViewStackPage:`icon-name],
* [property`ViewStackPage:`needs-attention], and
* [property`ViewStackPage:`badge-number] properties.
*
* Unlike [class`Gtk`.Stack], transitions between views can only be animated via
* a crossfade and size changes are always interpolated. Animations are disabled
* by default. Use [property`ViewStack:`enable-transitions] to enable them.
*
* `AdwViewStack` maintains a [class`ViewStackPage]` object for each added child,
* which holds additional per-child properties. You obtain the
* [class`ViewStackPage]` for a child with [method`ViewStack`.get_page] and you
* can obtain a [iface`Gtk`.SelectionModel] containing all the pages with
* [method`ViewStack`.get_pages].
*
* ## AdwViewStack as GtkBuildable
*
* To set child-specific properties in a .ui file, create
* [class`ViewStackPage]` objects explicitly, and set the child widget as a
* property on it:
*
* ```xml
* <object class="AdwViewStack" id="stack">
* <child>
* <object class="AdwViewStackPage">
* <property name="name">overview</property>
* <property name="title">Overview</property>
* <property name="child">
* <object class="AdwStatusPage">
* <property name="title">Welcome!</property>
* </object>
* </property>
* </object>
* </child>
* </object>
* ```
*
* ## CSS nodes
*
* `AdwViewStack` has a single CSS node named `stack`.
*
* ## Accessibility
*
* `AdwViewStack` uses the `GTK_ACCESSIBLE_ROLE_TAB_PANEL` for the stack pages
* which are the accessible parent objects of the child widgets.
*/
class ViewStack extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<ViewStack>;
// Properties
/**
* Whether the stack uses a crossfade transition between pages.
*
* Use [property`ViewStack:`transition-duration] to control the duration, and
* [property`ViewStack:`transition-running] to know when the transition is
* running.
*/
get enable_transitions(): boolean;
set enable_transitions(val: boolean);
/**
* Whether the stack uses a crossfade transition between pages.
*
* Use [property`ViewStack:`transition-duration] to control the duration, and
* [property`ViewStack:`transition-running] to know when the transition is
* running.
*/
get enableTransitions(): boolean;
set enableTransitions(val: boolean);
/**
* Whether the stack is horizontally homogeneous.
*
* If the stack is horizontally homogeneous, it allocates the same width for
* all children.
*
* If it's `FALSE`, the stack may change width when a different child becomes
* visible.
*/
get hhomogeneous(): boolean;
set hhomogeneous(val: boolean);
/**
* A selection model with the stack's pages.
*
* This can be used to keep an up-to-date view. The model also implements
* [iface`Gtk`.SelectionModel] and can be used to track and change the visible
* page.
*/
get pages(): Gtk.SelectionModel;
/**
* The transition animation duration, in milliseconds.
*
* Only used when [property`ViewStack:`enable-transitions] is set to `TRUE`.
*/
get transition_duration(): number;
set transition_duration(val: number);
/**
* The transition animation duration, in milliseconds.
*
* Only used when [property`ViewStack:`enable-transitions] is set to `TRUE`.
*/
get transitionDuration(): number;
set transitionDuration(val: number);
/**
* Whether a transition is currently running.
*
* If a transition is impossible, the property value will be set to `TRUE` and
* then immediately to `FALSE`, so it's possible to rely on its notifications
* to know that a transition has happened.
*/
get transition_running(): boolean;
/**
* Whether a transition is currently running.
*
* If a transition is impossible, the property value will be set to `TRUE` and
* then immediately to `FALSE`, so it's possible to rely on its notifications
* to know that a transition has happened.
*/
get transitionRunning(): boolean;
/**
* Whether the stack is vertically homogeneous.
*
* If the stack is vertically homogeneous, it allocates the same height for
* all children.
*
* If it's `FALSE`, the stack may change height when a different child becomes
* visible.
*/
get vhomogeneous(): boolean;
set vhomogeneous(val: boolean);
/**
* The widget currently visible in the stack.
*/
get visible_child(): Gtk.Widget;
set visible_child(val: Gtk.Widget);
/**
* The widget currently visible in the stack.
*/
get visibleChild(): Gtk.Widget;
set visibleChild(val: Gtk.Widget);
/**
* The name of the widget currently visible in the stack.
*
* See [property`ViewStack:`visible-child].
*/
get visible_child_name(): string;
set visible_child_name(val: string);
/**
* The name of the widget currently visible in the stack.
*
* See [property`ViewStack:`visible-child].
*/
get visibleChildName(): string;
set visibleChildName(val: string);
// Constructors
constructor(properties?: Partial<ViewStack.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): ViewStack;
// Methods
/**
* Adds a child to `self`.
* @param child the widget to add
* @returns the [class@ViewStackPage] for @child
*/
add(child: Gtk.Widget): ViewStackPage;
/**
* Adds a child to `self`.
*
* The child is identified by the `name`.
* @param child the widget to add
* @param name the name for @child
* @returns the `AdwViewStackPage` for @child
*/
add_named(child: Gtk.Widget, name?: string | null): ViewStackPage;
/**
* Adds a child to `self`.
*
* The child is identified by the `name`. The `title` will be used by
* [class`ViewSwitcher]` to represent `child,` so it should be short.
* @param child the widget to add
* @param name the name for @child
* @param title a human-readable title for @child
* @returns the `AdwViewStackPage` for @child
*/
add_titled(child: Gtk.Widget, name: string | null, title: string): ViewStackPage;
/**
* Adds a child to `self`.
*
* The child is identified by the `name`. The `title` and `icon_name` will be used
* by [class`ViewSwitcher]` to represent `child`.
* @param child the widget to add
* @param name the name for @child
* @param title a human-readable title for @child
* @param icon_name an icon name for @child
* @returns the `AdwViewStackPage` for @child
*/
add_titled_with_icon(
child: Gtk.Widget,
name: string | null,
title: string,
icon_name: string,
): ViewStackPage;
/**
* Finds the child with `name` in `self`.
* @param name the name of the child to find
* @returns the requested child
*/
get_child_by_name(name: string): Gtk.Widget | null;
/**
* Gets whether `self` uses a crossfade transition between pages.
*
* Use [property`ViewStack:`transition-duration] to control the duration, and
* [property`ViewStack:`transition-running] to know when the transition is
* running.
* @returns whether to enable page transitions
*/
get_enable_transitions(): boolean;
/**
* Gets whether `self` is horizontally homogeneous.
* @returns whether @self is horizontally homogeneous
*/
get_hhomogeneous(): boolean;
/**
* Gets the [class`ViewStackPage]` object for `child`.
* @param child a child of @self
* @returns the page object for @child
*/
get_page(child: Gtk.Widget): ViewStackPage;
/**
* Returns a [iface`Gio`.ListModel] that contains the pages of the stack.
*
* This can be used to keep an up-to-date view. The model also implements
* [iface`Gtk`.SelectionModel] and can be used to track and change the visible
* page.
* @returns a `GtkSelectionModel` for the stack's children
*/
get_pages(): Gtk.SelectionModel;
/**
* Gets the transition animation duration for `self`.
* @returns the transition duration, in milliseconds
*/
get_transition_duration(): number;
/**
* Gets whether a transition is currently running for `self`.
*
* If a transition is impossible, the property value will be set to `TRUE` and
* then immediately to `FALSE`, so it's possible to rely on its notifications
* to know that a transition has happened.
* @returns whether a transition is currently running
*/
get_transition_running(): boolean;
/**
* Gets whether `self` is vertically homogeneous.
* @returns whether @self is vertically homogeneous
*/
get_vhomogeneous(): boolean;
/**
* Gets the currently visible child of `self`.
* @returns the visible child
*/
get_visible_child(): Gtk.Widget | null;
/**
* Returns the name of the currently visible child of `self`.
* @returns the name of the visible child
*/
get_visible_child_name(): string | null;
/**
* Removes a child widget from `self`.
* @param child the child to remove
*/
remove(child: Gtk.Widget): void;
/**
* Sets whether `self` uses a crossfade transition between pages.
* @param enable_transitions whether to enable page transitions
*/
set_enable_transitions(enable_transitions: boolean): void;
/**
* Sets `self` to be horizontally homogeneous or not.
*
* If the stack is horizontally homogeneous, it allocates the same width for
* all children.
*
* If it's `FALSE`, the stack may change width when a different child becomes
* visible.
* @param hhomogeneous whether to make @self horizontally homogeneous
*/
set_hhomogeneous(hhomogeneous: boolean): void;
/**
* Sets the transition animation duration for `self`.
*
* Only used when [property`ViewStack:`enable-transitions] is set to `TRUE`.
* @param duration the new duration, in milliseconds
*/
set_transition_duration(duration: number): void;
/**
* Sets `self` to be vertically homogeneous or not.
*
* If the stack is vertically homogeneous, it allocates the same height for
* all children.
*
* If it's `FALSE`, the stack may change height when a different child becomes
* visible.
* @param vhomogeneous whether to make @self vertically homogeneous
*/
set_vhomogeneous(vhomogeneous: boolean): void;
/**
* Makes `child` the visible child of `self`.
* @param child a child of @self
*/
set_visible_child(child: Gtk.Widget): void;
/**
* Makes the child with `name` visible.
*
* See [property`ViewStack:`visible-child].
* @param name the name of the child
*/
set_visible_child_name(name: string): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 ViewStackPage {
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, Gtk.Accessible.ConstructorProps {
badge_number: number;
badgeNumber: number;
child: Gtk.Widget;
icon_name: string;
iconName: string;
name: string;
needs_attention: boolean;
needsAttention: boolean;
title: string;
use_underline: boolean;
useUnderline: boolean;
visible: boolean;
}
}
/**
* An auxiliary class used by [class`ViewStack]`.
*/
class ViewStackPage extends GObject.Object implements Gtk.Accessible {
static $gtype: GObject.GType<ViewStackPage>;
// Properties
/**
* The badge number for this page.
*
* [class`ViewSwitcher]` can display it as a badge next to the page icon. It is
* commonly used to display a number of unread items within the page.
*
* It can be used together with [property`ViewStack{`age}:needs-attention].
*/
get badge_number(): number;
set badge_number(val: number);
/**
* The badge number for this page.
*
* [class`ViewSwitcher]` can display it as a badge next to the page icon. It is
* commonly used to display a number of unread items within the page.
*
* It can be used together with [property`ViewStack{`age}:needs-attention].
*/
get badgeNumber(): number;
set badgeNumber(val: number);
/**
* The stack child to which the page belongs.
*/
get child(): Gtk.Widget;
/**
* The icon name of the child page.
*/
get icon_name(): string;
set icon_name(val: string);
/**
* The icon name of the child page.
*/
get iconName(): string;
set iconName(val: string);
/**
* The name of the child page.
*/
get name(): string;
set name(val: string);
/**
* Whether the page requires the user attention.
*
* [class`ViewSwitcher]` will display it as a dot next to the page icon.
*/
get needs_attention(): boolean;
set needs_attention(val: boolean);
/**
* Whether the page requires the user attention.
*
* [class`ViewSwitcher]` will display it as a dot next to the page icon.
*/
get needsAttention(): boolean;
set needsAttention(val: boolean);
/**
* The title of the child page.
*/
get title(): string;
set title(val: string);
/**
* Whether an embedded underline in the title indicates a mnemonic.
*/
get use_underline(): boolean;
set use_underline(val: boolean);
/**
* Whether an embedded underline in the title indicates a mnemonic.
*/
get useUnderline(): boolean;
set useUnderline(val: boolean);
/**
* Whether this page is visible.
*
* This is independent from the [property`Gtk`.Widget:visible] property of
* [property`ViewStackPage:`child].
*/
get visible(): boolean;
set visible(val: boolean);
// Constructors
constructor(properties?: Partial<ViewStackPage.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
// Methods
/**
* Gets the badge number for this page.
* @returns the badge number for this page
*/
get_badge_number(): number;
/**
* Gets the stack child to which `self` belongs.
* @returns the child to which @self belongs
*/
get_child(): Gtk.Widget;
/**
* Gets the icon name of the page.
* @returns the icon name of the page
*/
get_icon_name(): string | null;
/**
* Gets the name of the page.
* @returns the name of the page
*/
get_name(): string | null;
/**
* Gets whether the page requires the user attention.
* @returns whether the page needs attention
*/
get_needs_attention(): boolean;
/**
* Gets the page title.
* @returns the page title
*/
get_title(): string | null;
/**
* Gets whether underlines in the page title indicate mnemonics.
* @returns whether underlines in the page title indicate mnemonics
*/
get_use_underline(): boolean;
/**
* Gets whether `self` is visible in its `AdwViewStack`.
*
* This is independent from the [property`Gtk`.Widget:visible]
* property of its widget.
* @returns whether @self is visible
*/
get_visible(): boolean;
/**
* Sets the badge number for this page.
*
* [class`ViewSwitcher]` can display it as a badge next to the page icon. It is
* commonly used to display a number of unread items within the page.
*
* It can be used together with [property`ViewStack{`age}:needs-attention].
* @param badge_number the new value to set
*/
set_badge_number(badge_number: number): void;
/**
* Sets the icon name of the page.
* @param icon_name the icon name
*/
set_icon_name(icon_name?: string | null): void;
/**
* Sets the name of the page.
* @param name the page name
*/
set_name(name?: string | null): void;
/**
* Sets whether the page requires the user attention.
*
* [class`ViewSwitcher]` will display it as a dot next to the page icon.
* @param needs_attention the new value to set
*/
set_needs_attention(needs_attention: boolean): void;
/**
* Sets the page title.
* @param title the page title
*/
set_title(title?: string | null): void;
/**
* Sets whether underlines in the page title indicate mnemonics.
* @param use_underline the new value to set
*/
set_use_underline(use_underline: boolean): void;
/**
* Sets whether `page` is visible in its `AdwViewStack`.
*
* This is independent from the [property`Gtk`.Widget:visible] property of
* [property`ViewStackPage:`child].
* @param visible whether @self is visible
*/
set_visible(visible: boolean): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* 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 ViewStackPages {
// Constructor properties interface
interface ConstructorProps<A extends GObject.Object = GObject.Object>
extends GObject.Object.ConstructorProps,
Gio.ListModel.ConstructorProps,
Gtk.SelectionModel.ConstructorProps {
selected_page: ViewStackPage;
selectedPage: ViewStackPage;
}
}
/**
* An auxiliary class used by [class`ViewStack]`.
*
* See [property`ViewStack:`pages].
*/
class ViewStackPages<A extends GObject.Object = GObject.Object>
extends GObject.Object
implements Gio.ListModel<A>, Gtk.SelectionModel<A>
{
static $gtype: GObject.GType<ViewStackPages>;
// Properties
/**
* The selected [class`ViewStackPage]` within the [class`ViewStackPages]`.
*
* This can be used to keep an up-to-date view of the [class`ViewStackPage]` for
* The visible [class`ViewStackPage]` within the associated [class`ViewStackPages]`.
*
* This can be used to keep an up-to-date view of the visible child.
*/
get selected_page(): ViewStackPage;
set selected_page(val: ViewStackPage);
/**
* The selected [class`ViewStackPage]` within the [class`ViewStackPages]`.
*
* This can be used to keep an up-to-date view of the [class`ViewStackPage]` for
* The visible [class`ViewStackPage]` within the associated [class`ViewStackPages]`.
*
* This can be used to keep an up-to-date view of the visible child.
*/
get selectedPage(): ViewStackPage;
set selectedPage(val: ViewStackPage);
// Constructors
constructor(properties?: Partial<ViewStackPages.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
// Methods
/**
* Gets the [class`ViewStackPage]` for the visible child of a view stack
*
* Gets the [class`ViewStackPage]` for the visible child of the associated stack.
*
* Returns `NULL` if there's no selected page.
* @returns the stack page
*/
get_selected_page(): ViewStackPage | null;
/**
* Sets the visible child in the associated [class`ViewStack]`.
*
* See [property`ViewStack:`visible-child].
* @param page a stack page within the associated stack
*/
set_selected_page(page: ViewStackPage): void;
// Inherited methods
/**
* Gets the type of the items in `list`.
*
* All items returned from g_list_model_get_item() are of the type
* returned by this function, or a subtype, or if the type is an
* interface, they are an implementation of that interface.
*
* The item type of a #GListModel can not change during the life of the
* model.
* @returns the #GType of the items contained in @list.
*/
get_item_type(): GObject.GType;
/**
* Gets the number of items in `list`.
*
* Depending on the model implementation, calling this function may be
* less efficient than iterating the list with increasing values for
* `position` until g_list_model_get_item() returns %NULL.
* @returns the number of items in @list.
*/
get_n_items(): number;
/**
* Get the item at `position`.
*
* If `position` is greater than the number of items in `list,` %NULL is
* returned.
*
* %NULL is never returned for an index that is smaller than the length
* of the list.
*
* This function is meant to be used by language bindings in place
* of g_list_model_get_item().
*
* See also: g_list_model_get_n_items()
* @param position the position of the item to fetch
* @returns the object at @position.
*/
get_item(position: number): A | null;
/**
* Emits the #GListModel::items-changed signal on `list`.
*
* This function should only be called by classes implementing
* #GListModel. It has to be called after the internal representation
* of `list` has been updated, because handlers connected to this signal
* might query the new state of the list.
*
* Implementations must only make changes to the model (as visible to
* its consumer) in places that will not cause problems for that
* consumer. For models that are driven directly by a write API (such
* as #GListStore), changes can be reported in response to uses of that
* API. For models that represent remote data, changes should only be
* made from a fresh mainloop dispatch. It is particularly not
* permitted to make changes in response to a call to the #GListModel
* consumer API.
*
* Stated another way: in general, it is assumed that code making a
* series of accesses to the model via the API, without returning to the
* mainloop, and without calling other code, will continue to view the
* same contents of the model.
* @param position the position at which @list changed
* @param removed the number of items removed
* @param added the number of items added
*/
items_changed(position: number, removed: number, added: number): void;
/**
* Get the item at `position`. If `position` is greater than the number of
* items in `list,` %NULL is returned.
*
* %NULL is never returned for an index that is smaller than the length
* of the list. See g_list_model_get_n_items().
*
* The same #GObject instance may not appear more than once in a #GListModel.
* @param position the position of the item to fetch
*/
vfunc_get_item(position: number): A | null;
/**
* Gets the type of the items in `list`.
*
* All items returned from g_list_model_get_item() are of the type
* returned by this function, or a subtype, or if the type is an
* interface, they are an implementation of that interface.
*
* The item type of a #GListModel can not change during the life of the
* model.
*/
vfunc_get_item_type(): GObject.GType;
/**
* Gets the number of items in `list`.
*
* Depending on the model implementation, calling this function may be
* less efficient than iterating the list with increasing values for
* `position` until g_list_model_get_item() returns %NULL.
*/
vfunc_get_n_items(): number;
/**
* Gets the set containing all currently selected items in the model.
*
* This function may be slow, so if you are only interested in single item,
* consider using [method`Gtk`.SelectionModel.is_selected] or if you are only
* interested in a few, consider [method`Gtk`.SelectionModel.get_selection_in_range].
* @returns a `GtkBitset` containing all the values currently selected in @model. If no items are selected, the bitset is empty. The bitset must not be modified.
*/
get_selection(): Gtk.Bitset;
/**
* Gets the set of selected items in a range.
*
* This function is an optimization for
* [method`Gtk`.SelectionModel.get_selection] when you are only
* interested in part of the model's selected state. A common use
* case is in response to the [signal`Gtk`.SelectionModel::selection-changed]
* signal.
* @param position start of the queried range
* @param n_items number of items in the queried range
* @returns A `GtkBitset` that matches the selection state for the given range with all other values being undefined. The bitset must not be modified.
*/
get_selection_in_range(position: number, n_items: number): Gtk.Bitset;
/**
* Checks if the given item is selected.
* @param position the position of the item to query
* @returns %TRUE if the item is selected
*/
is_selected(position: number): boolean;
/**
* Requests to select all items in the model.
* @returns %TRUE if this action was supported and no fallback should be tried. This does not mean that all items are now selected.
*/
select_all(): boolean;
/**
* Requests to select an item in the model.
* @param position the position of the item to select
* @param unselect_rest whether previously selected items should be unselected
* @returns %TRUE if this action was supported and no fallback should be tried. This does not mean the item was selected.
*/
select_item(position: number, unselect_rest: boolean): boolean;
/**
* Requests to select a range of items in the model.
* @param position the first item to select
* @param n_items the number of items to select
* @param unselect_rest whether previously selected items should be unselected
* @returns %TRUE if this action was supported and no fallback should be tried. This does not mean the range was selected.
*/
select_range(position: number, n_items: number, unselect_rest: boolean): boolean;
/**
* Helper function for implementations of `GtkSelectionModel`.
*
* Call this when the selection changes to emit the
* [signal`Gtk`.SelectionModel::selection-changed] signal.
* @param position the first changed item
* @param n_items the number of changed items
*/
selection_changed(position: number, n_items: number): void;
/**
* Make selection changes.
*
* This is the most advanced selection updating method that allows
* the most fine-grained control over selection changes. If you can,
* you should try the simpler versions, as implementations are more
* likely to implement support for those.
*
* Requests that the selection state of all positions set in `mask`
* be updated to the respective value in the `selected` bitmask.
*
* In pseudocode, it would look something like this:
*
* ```c
* for (i = 0; i < n_items; i++)
* {
* // don't change values not in the mask
* if (!gtk_bitset_contains (mask, i))
* continue;
*
* if (gtk_bitset_contains (selected, i))
* select_item (i);
* else
* unselect_item (i);
* }
*
* gtk_selection_model_selection_changed (model,
* first_changed_item,
* n_changed_items);
* ```
*
* `mask` and `selected` must not be modified. They may refer to the
* same bitset, which would mean that every item in the set should
* be selected.
* @param selected bitmask specifying if items should be selected or unselected
* @param mask bitmask specifying which items should be updated
* @returns %TRUE if this action was supported and no fallback should be tried. This does not mean that all items were updated according to the inputs.
*/
set_selection(selected: Gtk.Bitset, mask: Gtk.Bitset): boolean;
/**
* Requests to unselect all items in the model.
* @returns %TRUE if this action was supported and no fallback should be tried. This does not mean that all items are now unselected.
*/
unselect_all(): boolean;
/**
* Requests to unselect an item in the model.
* @param position the position of the item to unselect
* @returns %TRUE if this action was supported and no fallback should be tried. This does not mean the item was unselected.
*/
unselect_item(position: number): boolean;
/**
* Requests to unselect a range of items in the model.
* @param position the first item to unselect
* @param n_items the number of items to unselect
* @returns %TRUE if this action was supported and no fallback should be tried. This does not mean the range was unselected.
*/
unselect_range(position: number, n_items: number): boolean;
/**
* Gets the set of selected items in a range.
*
* This function is an optimization for
* [method`Gtk`.SelectionModel.get_selection] when you are only
* interested in part of the model's selected state. A common use
* case is in response to the [signal`Gtk`.SelectionModel::selection-changed]
* signal.
* @param position start of the queried range
* @param n_items number of items in the queried range
*/
vfunc_get_selection_in_range(position: number, n_items: number): Gtk.Bitset;
/**
* Checks if the given item is selected.
* @param position the position of the item to query
*/
vfunc_is_selected(position: number): boolean;
/**
* Requests to select all items in the model.
*/
vfunc_select_all(): boolean;
/**
* Requests to select an item in the model.
* @param position the position of the item to select
* @param unselect_rest whether previously selected items should be unselected
*/
vfunc_select_item(position: number, unselect_rest: boolean): boolean;
/**
* Requests to select a range of items in the model.
* @param position the first item to select
* @param n_items the number of items to select
* @param unselect_rest whether previously selected items should be unselected
*/
vfunc_select_range(position: number, n_items: number, unselect_rest: boolean): boolean;
/**
* Make selection changes.
*
* This is the most advanced selection updating method that allows
* the most fine-grained control over selection changes. If you can,
* you should try the simpler versions, as implementations are more
* likely to implement support for those.
*
* Requests that the selection state of all positions set in `mask`
* be updated to the respective value in the `selected` bitmask.
*
* In pseudocode, it would look something like this:
*
* ```c
* for (i = 0; i < n_items; i++)
* {
* // don't change values not in the mask
* if (!gtk_bitset_contains (mask, i))
* continue;
*
* if (gtk_bitset_contains (selected, i))
* select_item (i);
* else
* unselect_item (i);
* }
*
* gtk_selection_model_selection_changed (model,
* first_changed_item,
* n_changed_items);
* ```
*
* `mask` and `selected` must not be modified. They may refer to the
* same bitset, which would mean that every item in the set should
* be selected.
* @param selected bitmask specifying if items should be selected or unselected
* @param mask bitmask specifying which items should be updated
*/
vfunc_set_selection(selected: Gtk.Bitset, mask: Gtk.Bitset): boolean;
/**
* Requests to unselect all items in the model.
*/
vfunc_unselect_all(): boolean;
/**
* Requests to unselect an item in the model.
* @param position the position of the item to unselect
*/
vfunc_unselect_item(position: number): boolean;
/**
* Requests to unselect a range of items in the model.
* @param position the first item to unselect
* @param n_items the number of items to unselect
*/
vfunc_unselect_range(position: number, n_items: number): boolean;
/**
* 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 ViewSwitcher {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
policy: ViewSwitcherPolicy;
stack: ViewStack;
}
}
/**
* An adaptive view switcher.
*
* <picture>
* <source srcset="view-switcher-dark.png" media="(prefers-color-scheme: dark)">
* <img src="view-switcher.png" alt="view-switcher">
* </picture>
*
* An adaptive view switcher designed to switch between multiple views
* contained in a [class`ViewStack]` in a similar fashion to
* [class`Gtk`.StackSwitcher].
*
* `AdwViewSwitcher` buttons always have an icon and a label. They can be
* displayed side by side, or icon on top of the label. This can be controlled
* via the [property`ViewSwitcher:`policy] property.
*
* `AdwViewSwitcher` is intended to be used in a header bar together with
* [class`ViewSwitcherBar]` at the bottom of the window, and a [class`Breakpoint]`
* showing the view switcher bar on narrow sizes, while removing the view
* switcher from the header bar, as follows:
*
* ```xml
* <object class="AdwWindow">
* <child>
* <object class="AdwBreakpoint">
* <condition>max-width: 550sp</condition>
* <setter object="switcher_bar" property="reveal">True</setter>
* <setter object="header_bar" property="title-widget"/>
* </object>
* </child>
* <property name="content">
* <object class="AdwToolbarView">
* <child type="top">
* <object class="AdwHeaderBar" id="header_bar">
* <property name="title-widget">
* <object class="AdwViewSwitcher">
* <property name="stack">stack</property>
* <property name="policy">wide</property>
* </object>
* </property>
* </object>
* </child>
* <property name="content">
* <object class="AdwViewStack" id="stack"/>
* </property>
* <child type="bottom">
* <object class="AdwViewSwitcherBar" id="switcher_bar">
* <property name="stack">stack</property>
* </object>
* </child>
* </object>
* </property>
* </object>
* ```
*
* It's recommended to set [property`ViewSwitcher:`policy] to
* `ADW_VIEW_SWITCHER_POLICY_WIDE` in this case.
*
* You may have to adjust the breakpoint condition for your specific pages.
*
* ## CSS nodes
*
* `AdwViewSwitcher` has a single CSS node with name `viewswitcher`. It can have
* the style classes `.wide` and `.narrow`, matching its policy.
*
* ## Accessibility
*
* `AdwViewSwitcher` uses the `GTK_ACCESSIBLE_ROLE_TAB_LIST` role and uses the
* `GTK_ACCESSIBLE_ROLE_TAB` for its buttons.
*/
class ViewSwitcher extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<ViewSwitcher>;
// Properties
/**
* The policy to determine which mode to use.
*/
get policy(): ViewSwitcherPolicy;
set policy(val: ViewSwitcherPolicy);
/**
* The stack the view switcher controls.
*/
get stack(): ViewStack;
set stack(val: ViewStack);
// Constructors
constructor(properties?: Partial<ViewSwitcher.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): ViewSwitcher;
// Methods
/**
* Gets the policy of `self`.
* @returns the policy of @self
*/
get_policy(): ViewSwitcherPolicy;
/**
* Gets the stack controlled by `self`.
* @returns the stack
*/
get_stack(): ViewStack | null;
/**
* Sets the policy of `self`.
* @param policy the new policy
*/
set_policy(policy: ViewSwitcherPolicy | null): void;
/**
* Sets the stack controlled by `self`.
* @param stack a stack
*/
set_stack(stack?: ViewStack | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 ViewSwitcherBar {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
reveal: boolean;
stack: ViewStack;
}
}
/**
* A view switcher action bar.
*
* <picture>
* <source srcset="view-switcher-bar-dark.png" media="(prefers-color-scheme: dark)">
* <img src="view-switcher-bar.png" alt="view-switcher-bar">
* </picture>
*
* An action bar letting you switch between multiple views contained in a
* [class`ViewStack]`, via an [class`ViewSwitcher]`. It is designed to be put at
* the bottom of a window and to be revealed only on really narrow windows, e.g.
* on mobile phones. It can't be revealed if there are less than two pages.
*
* `AdwViewSwitcherBar` is intended to be used together with
* `AdwViewSwitcher` in a header bar, and a [class`Breakpoint]` showing the view
* switcher bar on narrow sizes, while removing the view switcher from the
* header bar, as follows:
*
* ```xml
* <object class="AdwWindow">
* <child>
* <object class="AdwBreakpoint">
* <condition>max-width: 550sp</condition>
* <setter object="switcher_bar" property="reveal">True</setter>
* <setter object="header_bar" property="title-widget"/>
* </object>
* </child>
* <property name="content">
* <object class="AdwToolbarView">
* <child type="top">
* <object class="AdwHeaderBar" id="header_bar">
* <property name="title-widget">
* <object class="AdwViewSwitcher">
* <property name="stack">stack</property>
* <property name="policy">wide</property>
* </object>
* </property>
* </object>
* </child>
* <property name="content">
* <object class="AdwViewStack" id="stack"/>
* </property>
* <child type="bottom">
* <object class="AdwViewSwitcherBar" id="switcher_bar">
* <property name="stack">stack</property>
* </object>
* </child>
* </object>
* </property>
* </object>
* ```
*
* It's recommended to set [property`ViewSwitcher:`policy] to
* `ADW_VIEW_SWITCHER_POLICY_WIDE` in this case.
*
* You may have to adjust the breakpoint condition for your specific pages.
*
* ## CSS nodes
*
* `AdwViewSwitcherBar` has a single CSS node with name` viewswitcherbar`.
*/
class ViewSwitcherBar extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<ViewSwitcherBar>;
// Properties
/**
* Whether the bar should be revealed or hidden.
*/
get reveal(): boolean;
set reveal(val: boolean);
/**
* The stack the view switcher controls.
*/
get stack(): ViewStack;
set stack(val: ViewStack);
// Constructors
constructor(properties?: Partial<ViewSwitcherBar.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): ViewSwitcherBar;
// Methods
/**
* Gets whether `self` should be revealed or hidden.
* @returns whether @self is revealed
*/
get_reveal(): boolean;
/**
* Gets the stack controlled by `self`.
* @returns the stack
*/
get_stack(): ViewStack | null;
/**
* Sets whether `self` should be revealed or hidden.
* @param reveal whether to reveal @self
*/
set_reveal(reveal: boolean): void;
/**
* Sets the stack controlled by `self`.
* @param stack a stack
*/
set_stack(stack?: ViewStack | null): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 ViewSwitcherTitle {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
stack: ViewStack;
subtitle: string;
title: string;
title_visible: boolean;
titleVisible: boolean;
view_switcher_enabled: boolean;
viewSwitcherEnabled: boolean;
}
}
/**
* A view switcher title.
*
* <picture>
* <source srcset="view-switcher-title-dark.png" media="(prefers-color-scheme: dark)">
* <img src="view-switcher-title.png" alt="view-switcher-title">
* </picture>
*
* A widget letting you switch between multiple views contained by a
* [class`ViewStack]` via an [class`ViewSwitcher]`.
*
* It is designed to be used as the title widget of a [class`HeaderBar]`, and
* will display the window's title when the window is too narrow to fit the view
* switcher e.g. on mobile phones, or if there are less than two views.
*
* In order to center the title in narrow windows, the header bar should have
* [property`HeaderBar:`centering-policy] set to
* `ADW_CENTERING_POLICY_STRICT`.
*
* `AdwViewSwitcherTitle` is intended to be used together with
* [class`ViewSwitcherBar]`.
*
* A common use case is to bind the [property`ViewSwitcherBar:`reveal] property
* to [property`ViewSwitcherTitle:`title-visible] to automatically reveal the
* view switcher bar when the title label is displayed in place of the view
* switcher, as follows:
*
* ```xml
* <object class="AdwWindow">
* <property name="content">
* <object class="AdwToolbarView">
* <child type="top">
* <object class="AdwHeaderBar">
* <property name="centering-policy">strict</property>
* <property name="title-widget">
* <object class="AdwViewSwitcherTitle" id="title">
* <property name="stack">stack</property>
* </object>
* </property>
* </object>
* </child>
* <property name="content">
* <object class="AdwViewStack" id="stack"/>
* </property>
* <child type="bottom">
* <object class="AdwViewSwitcherBar">
* <property name="stack">stack</property>
* <binding name="reveal">
* <lookup name="title-visible">title</lookup>
* </binding>
* </object>
* </child>
* </object>
* </property>
* </object>
* ```
*
* ## CSS nodes
*
* `AdwViewSwitcherTitle` has a single CSS node with name `viewswitchertitle`.
*/
class ViewSwitcherTitle extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<ViewSwitcherTitle>;
// Properties
/**
* The stack the view switcher controls.
*/
get stack(): ViewStack;
set stack(val: ViewStack);
/**
* The subtitle to display.
*
* The subtitle should give the user additional details.
*/
get subtitle(): string;
set subtitle(val: string);
/**
* The title to display.
*
* The title typically identifies the current view or content item, and
* generally does not use the application name.
*/
get title(): string;
set title(val: string);
/**
* Whether the title is currently visible.
*
* If the title is visible, it means the view switcher is hidden an it may be
* wanted to show an alternative switcher, e.g. a [class`ViewSwitcherBar]`.
*/
get title_visible(): boolean;
/**
* Whether the title is currently visible.
*
* If the title is visible, it means the view switcher is hidden an it may be
* wanted to show an alternative switcher, e.g. a [class`ViewSwitcherBar]`.
*/
get titleVisible(): boolean;
/**
* Whether the view switcher is enabled.
*
* If it is disabled, the title will be displayed instead. This allows to
* programmatically hide the view switcher even if it fits in the available
* space.
*
* This can be used e.g. to ensure the view switcher is hidden below a certain
* window width, or any other constraint you find suitable.
*/
get view_switcher_enabled(): boolean;
set view_switcher_enabled(val: boolean);
/**
* Whether the view switcher is enabled.
*
* If it is disabled, the title will be displayed instead. This allows to
* programmatically hide the view switcher even if it fits in the available
* space.
*
* This can be used e.g. to ensure the view switcher is hidden below a certain
* window width, or any other constraint you find suitable.
*/
get viewSwitcherEnabled(): boolean;
set viewSwitcherEnabled(val: boolean);
// Constructors
constructor(properties?: Partial<ViewSwitcherTitle.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): ViewSwitcherTitle;
// Methods
/**
* Gets the stack controlled by `self`.
* @returns the stack
*/
get_stack(): ViewStack | null;
/**
* Gets the subtitle of `self`.
* @returns the subtitle
*/
get_subtitle(): string;
/**
* Gets the title of `self`.
* @returns the title
*/
get_title(): string;
/**
* Gets whether the title of `self` is currently visible.
*
* If the title is visible, it means the view switcher is hidden an it may be
* wanted to show an alternative switcher, e.g. a [class`ViewSwitcherBar]`.
* @returns whether the title of @self is currently visible
*/
get_title_visible(): boolean;
/**
* Gets whether `self'`s view switcher is enabled.
* @returns whether the view switcher is enabled
*/
get_view_switcher_enabled(): boolean;
/**
* Sets the stack controlled by `self`.
* @param stack a stack
*/
set_stack(stack?: ViewStack | null): void;
/**
* Sets the subtitle of `self`.
*
* The subtitle should give the user additional details.
* @param subtitle a subtitle
*/
set_subtitle(subtitle: string): void;
/**
* Sets the title of `self`.
*
* The title typically identifies the current view or content item, and
* generally does not use the application name.
* @param title a title
*/
set_title(title: string): void;
/**
* Sets whether `self'`s view switcher is enabled.
*
* If it is disabled, the title will be displayed instead. This allows to
* programmatically hide the view switcher even if it fits in the available
* space.
*
* This can be used e.g. to ensure the view switcher is hidden below a certain
* window width, or any other constraint you find suitable.
* @param enabled whether the view switcher is enabled
*/
set_view_switcher_enabled(enabled: boolean): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 Window {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Window.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Native.ConstructorProps,
Gtk.Root.ConstructorProps,
Gtk.ShortcutManager.ConstructorProps {
adaptive_preview: boolean;
adaptivePreview: boolean;
content: Gtk.Widget;
current_breakpoint: Breakpoint;
currentBreakpoint: Breakpoint;
dialogs: Gio.ListModel;
visible_dialog: Dialog;
visibleDialog: Dialog;
}
}
/**
* A freeform window.
*
* <picture>
* <source srcset="window-dark.png" media="(prefers-color-scheme: dark)">
* <img src="window.png" alt="window">
* </picture>
*
* The `AdwWindow` widget is a subclass of [class`Gtk`.Window] which has no
* titlebar area. Instead, [class`ToolbarView]` can be used together with
* [class`HeaderBar]` or [class`Gtk`.HeaderBar] as follows:
*
* ```xml
* <object class="AdwWindow">
* <property name="content">
* <object class="AdwToolbarView">
* <child type="top">
* <object class="AdwHeaderBar"/>
* </child>
* <property name="content">
* <!-- ... -->
* </property>
* </object>
* </property>
* </object>
* ```
*
* Using [property`Gtk`.Window:titlebar] or [property`Gtk`.Window:child]
* is not supported and will result in a crash. Use [property`Window:`content]
* instead.
*
* ## Dialogs
*
* `AdwWindow` can contain [class`Dialog]`. Use [method`Dialog`.present] with the
* window or a widget within a window to show a dialog.
*
* ## Breakpoints
*
* `AdwWindow` can be used with [class`Breakpoint]` the same way as
* [class`BreakpointBin]`. Refer to that widget's documentation for details.
*
* Example:
*
* ```xml
* <object class="AdwWindow">
* <property name="content">
* <object class="AdwToolbarView">
* <child type="top">
* <object class="AdwHeaderBar"/>
* </child>
* <property name="content">
* <!-- ... -->
* </property>
* <child type="bottom">
* <object class="GtkActionBar" id="bottom_bar">
* <property name="revealed">True</property>
* <property name="visible">False</property>
* </object>
* </child>
* </object>
* </property>
* <child>
* <object class="AdwBreakpoint">
* <condition>max-width: 500px</condition>
* <setter object="bottom_bar" property="visible">True</setter>
* </object>
* </child>
* </object>
* ```
*
* When breakpoints are used, the minimum size must be larger than the smallest
* UI state. `AdwWindow` defaults to the minimum size of 360×200 px. If that's
* too small, set the [property`Gtk`.Widget:width-request] and
* [property`Gtk`.Widget:height-request] properties manually.
*
* ## Adaptive Preview
*
* `AdwWindow` has a debug tool called adaptive preview. It can be opened from
* GTK Inspector or by pressing <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>M</kbd>,
* and controlled via the [property`Window:`adaptive-preview] property.
*/
class Window
extends Gtk.Window
implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Native, Gtk.Root, Gtk.ShortcutManager
{
static $gtype: GObject.GType<Window>;
// Properties
/**
* Whether adaptive preview is currently open.
*
* Adaptive preview is a debugging tool used for testing the window
* contents at specific screen sizes, simulating mobile environment.
*
* Adaptive preview can always be accessed from inspector. This function
* allows applications to open it manually.
*
* Most applications should not use this property.
*/
get adaptive_preview(): boolean;
set adaptive_preview(val: boolean);
/**
* Whether adaptive preview is currently open.
*
* Adaptive preview is a debugging tool used for testing the window
* contents at specific screen sizes, simulating mobile environment.
*
* Adaptive preview can always be accessed from inspector. This function
* allows applications to open it manually.
*
* Most applications should not use this property.
*/
get adaptivePreview(): boolean;
set adaptivePreview(val: boolean);
/**
* The content widget.
*
* This property should always be used instead of [property`Gtk`.Window:child].
*/
get content(): Gtk.Widget;
set content(val: Gtk.Widget);
/**
* The current breakpoint.
*/
get current_breakpoint(): Breakpoint;
/**
* The current breakpoint.
*/
get currentBreakpoint(): Breakpoint;
/**
* The open dialogs.
*/
get dialogs(): Gio.ListModel;
/**
* The currently visible dialog
*/
get visible_dialog(): Dialog;
/**
* The currently visible dialog
*/
get visibleDialog(): Dialog;
// Constructors
constructor(properties?: Partial<Window.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): Window;
// Methods
/**
* Adds `breakpoint` to `self`.
* @param breakpoint the breakpoint to add
*/
add_breakpoint(breakpoint: Breakpoint): void;
/**
* Gets whether adaptive preview for `self` is currently open.
* @returns whether adaptive preview is open.
*/
get_adaptive_preview(): boolean;
/**
* Gets the content widget of `self`.
*
* This method should always be used instead of [method`Gtk`.Window.get_child].
* @returns the content widget of @self
*/
get_content(): Gtk.Widget | null;
/**
* Gets the current breakpoint.
* @returns the current breakpoint
*/
get_current_breakpoint(): Breakpoint | null;
/**
* Returns a [iface`Gio`.ListModel] that contains the open dialogs of `self`.
*
* This can be used to keep an up-to-date view.
* @returns a list model for the dialogs of @self
*/
get_dialogs(): Gio.ListModel;
/**
* Returns the currently visible dialog in `self,` if there's one.
* @returns the visible dialog
*/
get_visible_dialog(): Dialog | null;
/**
* Sets whether adaptive preview for `self` is currently open.
*
* Adaptive preview is a debugging tool used for testing the window
* contents at specific screen sizes, simulating mobile environment.
*
* Adaptive preview can always be accessed from inspector. This function
* allows applications to open it manually.
*
* Most applications should not use this function.
* @param adaptive_preview whether to open adaptive preview
*/
set_adaptive_preview(adaptive_preview: boolean): void;
/**
* Sets the content widget of `self`.
*
* This method should always be used instead of [method`Gtk`.Window.set_child].
* @param content the content widget
*/
set_content(content?: Gtk.Widget | null): void;
// Inherited properties
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get can_focus(): boolean;
set can_focus(val: boolean);
/**
* Whether the widget or any of its descendents can accept
* the input focus.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get canFocus(): boolean;
set canFocus(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get can_target(): boolean;
set can_target(val: boolean);
/**
* Whether the widget can receive pointer events.
*/
get canTarget(): boolean;
set canTarget(val: boolean);
/**
* A list of css classes applied to this widget.
*/
get css_classes(): string[];
set css_classes(val: string[]);
/**
* A list of css classes applied to this widget.
*/
get cssClasses(): string[];
set cssClasses(val: string[]);
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get css_name(): string;
/**
* The name of this widget in the CSS tree.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get cssName(): string;
/**
* The cursor used by `widget`.
*/
get cursor(): Gdk.Cursor;
set cursor(val: Gdk.Cursor);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focus_on_click(): boolean;
set focus_on_click(val: boolean);
/**
* Whether the widget should grab focus when it is clicked with the mouse.
*
* This property is only relevant for widgets that can take focus.
*/
get focusOnClick(): boolean;
set focusOnClick(val: boolean);
/**
* Whether this widget itself will accept the input focus.
*/
get focusable(): boolean;
set focusable(val: boolean);
/**
* How to distribute horizontal space if widget gets extra space.
*/
get halign(): Gtk.Align;
set halign(val: Gtk.Align);
/**
* Whether the widget is the default widget.
*/
get has_default(): boolean;
/**
* Whether the widget is the default widget.
*/
get hasDefault(): boolean;
/**
* Whether the widget has the input focus.
*/
get has_focus(): boolean;
/**
* Whether the widget has the input focus.
*/
get hasFocus(): boolean;
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get has_tooltip(): boolean;
set has_tooltip(val: boolean);
/**
* Enables or disables the emission of the [signal`Gtk`.Widget::query-tooltip]
* signal on `widget`.
*
* A true value indicates that `widget` can have a tooltip, in this case
* the widget will be queried using [signal`Gtk`.Widget::query-tooltip] to
* determine whether it will provide a tooltip or not.
*/
get hasTooltip(): boolean;
set hasTooltip(val: boolean);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get height_request(): number;
set height_request(val: number);
/**
* Overrides for height request of the widget.
*
* If this is -1, the natural request will be used.
*/
get heightRequest(): number;
set heightRequest(val: number);
/**
* Whether to expand horizontally.
*/
get hexpand(): boolean;
set hexpand(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpand_set(): boolean;
set hexpand_set(val: boolean);
/**
* Whether to use the `hexpand` property.
*/
get hexpandSet(): boolean;
set hexpandSet(val: boolean);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layout_manager(): Gtk.LayoutManager;
set layout_manager(val: Gtk.LayoutManager);
/**
* The [class`Gtk`.LayoutManager] instance to use to compute
* the preferred size of the widget, and allocate its children.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get layoutManager(): Gtk.LayoutManager;
set layoutManager(val: Gtk.LayoutManager);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limit_events(): boolean;
set limit_events(val: boolean);
/**
* Makes this widget act like a modal dialog, with respect to
* event delivery.
*
* Global event controllers will not handle events with targets
* inside the widget, unless they are set up to ignore propagation
* limits. See [method`Gtk`.EventController.set_propagation_limit].
*/
get limitEvents(): boolean;
set limitEvents(val: boolean);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_bottom(): number;
set margin_bottom(val: number);
/**
* Margin on bottom side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginBottom(): number;
set marginBottom(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_end(): number;
set margin_end(val: number);
/**
* Margin on end of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginEnd(): number;
set marginEnd(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_start(): number;
set margin_start(val: number);
/**
* Margin on start of widget, horizontally.
*
* This property supports left-to-right and right-to-left text
* directions.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginStart(): number;
set marginStart(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get margin_top(): number;
set margin_top(val: number);
/**
* Margin on top side of widget.
*
* This property adds margin outside of the widget's normal size
* request, the margin will be added in addition to the size from
* [method`Gtk`.Widget.set_size_request] for example.
*/
get marginTop(): number;
set marginTop(val: number);
/**
* The name of the widget.
*/
get name(): string;
set name(val: string);
/**
* The requested opacity of the widget.
*/
get opacity(): number;
set opacity(val: number);
/**
* How content outside the widget's content area is treated.
*
* This property is meant to be set by widget implementations,
* typically in their instance init function.
*/
get overflow(): Gtk.Overflow;
set overflow(val: Gtk.Overflow);
/**
* The parent widget of this widget.
*/
get parent(): Gtk.Widget;
/**
* Whether the widget will receive the default action when it is focused.
*/
get receives_default(): boolean;
set receives_default(val: boolean);
/**
* Whether the widget will receive the default action when it is focused.
*/
get receivesDefault(): boolean;
set receivesDefault(val: boolean);
/**
* The `GtkRoot` widget of the widget tree containing this widget.
*
* This will be `NULL` if the widget is not contained in a root widget.
*/
get root(): Gtk.Root;
/**
* The scale factor of the widget.
*/
get scale_factor(): number;
/**
* The scale factor of the widget.
*/
get scaleFactor(): number;
/**
* Whether the widget responds to input.
*/
get sensitive(): boolean;
set sensitive(val: boolean);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_markup(): string;
set tooltip_markup(val: string);
/**
* Sets the text of tooltip to be the given string, which is marked up
* with Pango markup.
*
* Also see [method`Gtk`.Tooltip.set_markup].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipMarkup(): string;
set tooltipMarkup(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltip_text(): string;
set tooltip_text(val: string);
/**
* Sets the text of tooltip to be the given string.
*
* Also see [method`Gtk`.Tooltip.set_text].
*
* This is a convenience property which will take care of getting the
* tooltip shown if the given string is not `NULL`:
* [property`Gtk`.Widget:has-tooltip] will automatically be set to true
* and there will be taken care of [signal`Gtk`.Widget::query-tooltip] in
* the default signal handler.
*
* Note that if both [property`Gtk`.Widget:tooltip-text] and
* [property`Gtk`.Widget:tooltip-markup] are set, the last one wins.
*/
get tooltipText(): string;
set tooltipText(val: string);
/**
* How to distribute vertical space if widget gets extra space.
*/
get valign(): Gtk.Align;
set valign(val: Gtk.Align);
/**
* Whether to expand vertically.
*/
get vexpand(): boolean;
set vexpand(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpand_set(): boolean;
set vexpand_set(val: boolean);
/**
* Whether to use the `vexpand` property.
*/
get vexpandSet(): boolean;
set vexpandSet(val: boolean);
/**
* Whether the widget is visible.
*/
get visible(): boolean;
set visible(val: boolean);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get width_request(): number;
set width_request(val: number);
/**
* Overrides for width request of the widget.
*
* If this is -1, the natural request will be used.
*/
get widthRequest(): number;
set widthRequest(val: number);
// Inherited methods
/**
* Returns the renderer that is used for this `GtkNative`.
* @returns the renderer for @self
*/
get_renderer(): Gsk.Renderer | null;
/**
* Returns the surface of this `GtkNative`.
* @returns the surface of @self
*/
get_surface(): Gdk.Surface | null;
/**
* Retrieves the surface transform of `self`.
*
* This is the translation from `self'`s surface coordinates into
* `self'`s widget coordinates.
*/
get_surface_transform(): [number, number];
/**
* Realizes a `GtkNative`.
*
* This should only be used by subclasses.
*/
realize(): void;
/**
* Unrealizes a `GtkNative`.
*
* This should only be used by subclasses.
*/
unrealize(): void;
/**
* Returns the display that this `GtkRoot` is on.
* @returns the display of @root
*/
get_display(): Gdk.Display;
/**
* Retrieves the current focused widget within the root.
*
* Note that this is the widget that would have the focus
* if the root is active; if the root is not focused then
* `gtk_widget_has_focus (widget)` will be %FALSE for the
* widget.
* @returns the currently focused widget
*/
get_focus(): Gtk.Widget | null;
/**
* If `focus` is not the current focus widget, and is focusable, sets
* it as the focus widget for the root.
*
* If `focus` is %NULL, unsets the focus widget for the root.
*
* To set the focus to a particular widget in the root, it is usually
* more convenient to use [method`Gtk`.Widget.grab_focus] instead of
* this function.
* @param focus widget to be the new focus widget, or %NULL to unset the focus widget
*/
set_focus(focus?: Gtk.Widget | null): void;
/**
* Add a `GtkShortcutController` to be managed.
* @param controller
*/
vfunc_add_controller(controller: Gtk.ShortcutController): void;
/**
* Remove a `GtkShortcutController` that had previously
* been added
* @param controller
*/
vfunc_remove_controller(controller: Gtk.ShortcutController): 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;
/**
* Enables or disables an action installed with
* [method`Gtk`.WidgetClass.install_action].
* @param action_name action name, such as "clipboard.paste"
* @param enabled whether the action is now enabled
*/
action_set_enabled(action_name: string, enabled: boolean): void;
/**
* Activates the widget.
*
* The activation will emit the signal set using
* [method`Gtk`.WidgetClass.set_activate_signal]
* during class initialization.
*
* Activation is what happens when you press <kbd>Enter</kbd>
* on a widget.
*
* If you wish to handle the activation keybinding yourself,
* it is recommended to use [method`Gtk`.WidgetClass.add_shortcut]
* with an action created with [ctor`Gtk`.SignalAction.new].
*
* If `widget` is not activatable, the function returns false.
* @returns true if the widget was activated
*/
activate(): boolean;
/**
* Activates an action for the widget.
*
* The action is looked up in the action groups associated with
* `widget` and its ancestors.
*
* If the action is in an action group added with
* [method`Gtk`.Widget.insert_action_group], the `name` is expected
* to be prefixed with the prefix that was used when the group was
* inserted.
*
* The arguments must match the actions expected parameter type,
* as returned by [method`Gio`.Action.get_parameter_type].
* @param name the name of the action to activate
* @param args parameters to use
* @returns true if the action was activated
*/
activate_action(name: string, args?: GLib.Variant | null): boolean;
/**
* Activates the `default.activate` action for the widget.
*
* The action is looked up in the same was as for
* [method`Gtk`.Widget.activate_action].
*/
activate_default(): void;
/**
* Adds an event controller to the widget.
*
* The event controllers of a widget handle the events that are
* propagated to the widget.
*
* You will usually want to call this function right after
* creating any kind of [class`Gtk`.EventController].
* @param controller an event controller that hasn't been added to a widget yet
*/
add_controller(controller: Gtk.EventController): void;
/**
* Adds a style class to the widget.
*
* After calling this function, the widgets style will match
* for `css_class,` according to CSS matching rules.
*
* Use [method`Gtk`.Widget.remove_css_class] to remove the
* style again.
* @param css_class style class to add to @widget, without the leading period
*/
add_css_class(css_class: string): void;
/**
* Adds a widget to the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* Note that the list of mnemonic labels for the widget is cleared
* when the widget is destroyed, so the caller must make sure
* to update its internal state at this point as well.
* @param label a widget that acts as a mnemonic label for @widget
*/
add_mnemonic_label(label: Gtk.Widget): void;
/**
* Queues an animation frame update and adds a callback to be called
* before each frame.
*
* Until the tick callback is removed, it will be called frequently
* (usually at the frame rate of the output device or as quickly as
* the application can be repainted, whichever is slower). For this
* reason, is most suitable for handling graphics that change every
* frame or every few frames.
*
* The tick callback does not automatically imply a relayout or repaint.
* If you want a repaint or relayout, and arent changing widget properties
* that would trigger that (for example, changing the text of a label),
* then you will have to call [method`Gtk`.Widget.queue_resize] or
* [method`Gtk`.Widget.queue_draw] yourself.
*
* [method`Gdk`.FrameClock.get_frame_time] should generally be used
* for timing continuous animations and
* [method`Gdk`.FrameTimings.get_predicted_presentation_time] should be
* used if you are trying to display isolated frames at particular times.
*
* This is a more convenient alternative to connecting directly to the
* [signal`Gdk`.FrameClock::update] signal of the frame clock, since you
* don't have to worry about when a frame clock is assigned to a widget.
*
* To remove a tick callback, pass the ID that is returned by this function
* to [method`Gtk`.Widget.remove_tick_callback].
* @param callback function to call for updating animations
* @returns an ID for this callback
*/
add_tick_callback(callback: Gtk.TickCallback): number;
/**
* Assigns size, position, (optionally) a baseline and transform
* to a child widget.
*
* In this function, the allocation and baseline may be adjusted.
* The given allocation will be forced to be bigger than the
* widget's minimum size, as well as at least 0×0 in size.
*
* This function is only used by widget implementations.
*
* For a version that does not take a transform, see
* [method`Gtk`.Widget.size_allocate].
* @param width new width
* @param height new height
* @param baseline new baseline, or -1
* @param transform transformation to be applied
*/
allocate(width: number, height: number, baseline: number, transform?: Gsk.Transform | null): void;
/**
* Called by widgets as the user moves around the window using
* keyboard shortcuts.
*
* The `direction` argument indicates what kind of motion is taking
* place (up, down, left, right, tab forward, tab backward).
*
* This function calls the [vfunc`Gtk`.Widget.focus] virtual function;
* widgets can override the virtual function in order to implement
* appropriate focus behavior.
*
* The default `focus()` virtual function for a widget should return
* true if moving in `direction` left the focus on a focusable location
* inside that widget, and false if moving in `direction` moved the focus
* outside the widget. When returning true, widgets normally call
* [method`Gtk`.Widget.grab_focus] to place the focus accordingly;
* when returning false, they dont modify the current focus location.
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use [method`Gtk`.Widget.grab_focus] to move
* the focus to a particular widget.
* @param direction direction of focus movement
* @returns true if focus ended up inside @widget
*/
child_focus(direction: Gtk.DirectionType | null): boolean;
/**
* Computes the bounds for `widget` in the coordinate space of `target`.
*
* The bounds of widget are (the bounding box of) the region that it is
* expected to draw in. See the [coordinate system](coordinates.html)
* overview to learn more.
*
* If the operation is successful, true is returned. If `widget` has no
* bounds or the bounds cannot be expressed in `target'`s coordinate space
* (for example if both widgets are in different windows), false is
* returned and `bounds` is set to the zero rectangle.
*
* It is valid for `widget` and `target` to be the same widget.
* @param target the target widget
* @returns true if the bounds could be computed
*/
compute_bounds(target: Gtk.Widget): [boolean, Graphene.Rect];
/**
* Computes whether a parent widget should give this widget
* extra space when possible.
*
* Widgets with children should check this, rather than looking at
* [method`Gtk`.Widget.get_hexpand] or [method`Gtk`.Widget.get_vexpand].
*
* This function already checks whether the widget is visible, so
* visibility does not need to be checked separately. Non-visible
* widgets are not expanded.
*
* The computed expand value uses either the expand setting explicitly
* set on the widget itself, or, if none has been explicitly set,
* the widget may expand if some of its children do.
* @param orientation expand direction
* @returns whether widget tree rooted here should be expanded
*/
compute_expand(orientation: Gtk.Orientation | null): boolean;
/**
* Translates the given `point` in `widget'`s coordinates to coordinates
* in `target`s coordinate system.
*
* In order to perform this operation, both widgets must share a
* a common ancestor. If that is not the case, `out_point` is set
* to (0, 0) and false is returned.
* @param target the widget to transform into
* @param point a point in @widget's coordinate system
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
compute_point(target: Gtk.Widget, point: Graphene.Point): [boolean, Graphene.Point];
/**
* Computes a matrix suitable to describe a transformation from
* `widget'`s coordinate system into `target'`s coordinate system.
*
* The transform can not be computed in certain cases, for example
* when `widget` and `target` do not share a common ancestor. In that
* case `out_transform` gets set to the identity matrix.
*
* To learn more about widget coordinate systems, see the coordinate
* system [overview](coordinates.html).
* @param target the target widget that the matrix will transform to
* @returns true if the transform could be computed
*/
compute_transform(target: Gtk.Widget): [boolean, Graphene.Matrix];
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
* @returns true if @widget contains the point (x, y)
*/
contains(x: number, y: number): boolean;
/**
* Creates a new `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map,
* font options, font description, and base direction set.
*
* See also [method`Gtk`.Widget.get_pango_context].
* @returns the new `PangoContext`
*/
create_pango_context(): Pango.Context;
/**
* Creates a new `PangoLayout` that is configured for the widget.
*
* The `PangoLayout` will have the appropriate font map,
* font description, and base direction set.
*
* If you keep a `PangoLayout` created in this way around,
* you need to re-create it when the widgets `PangoContext`
* is replaced. This can be tracked by listening to changes
* of the [property`Gtk`.Widget:root] property on the widget.
* @param text text to set on the layout
* @returns the new `PangoLayout`
*/
create_pango_layout(text?: string | null): Pango.Layout;
/**
* Clears the template children for the widget.
*
* This function is the opposite of [method`Gtk`.Widget.init_template],
* and it is used to clear all the template children from a widget
* instance. If you bound a template child to a field in the instance
* structure, or in the instance private data structure, the field will
* be set to `NULL` after this function returns.
*
* You should call this function inside the `GObjectClass.dispose()`
* implementation of any widget that called [method`Gtk`.Widget.init_template].
* Typically, you will want to call this function last, right before
* chaining up to the parent type's dispose implementation, e.g.
*
* ```c
* static void
* some_widget_dispose (GObject *gobject)
* {
* SomeWidget *self = SOME_WIDGET (gobject);
*
* // Clear the template data for SomeWidget
* gtk_widget_dispose_template (GTK_WIDGET (self), SOME_TYPE_WIDGET);
*
* G_OBJECT_CLASS (some_widget_parent_class)->dispose (gobject);
* }
* ```
* @param widget_type the type of the widget to finalize the template for
*/
dispose_template(widget_type: GObject.GType): void;
/**
* Checks to see if a drag movement has passed the GTK drag threshold.
* @param start_x X coordinate of start of drag
* @param start_y Y coordinate of start of drag
* @param current_x current X coordinate
* @param current_y current Y coordinate
* @returns true if the drag threshold has been passed
*/
drag_check_threshold(start_x: number, start_y: number, current_x: number, current_y: number): boolean;
/**
* Notifies the user about an input-related error on the widget.
*
* If the [property`Gtk`.Settings:gtk-error-bell] setting is true,
* it calls [method`Gdk`.Surface.beep], otherwise it does nothing.
*
* Note that the effect of [method`Gdk`.Surface.beep] can be configured
* in many ways, depending on the windowing backend and the desktop
* environment or window manager that is used.
*/
error_bell(): void;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidget`Class.snapshot() function, and when allocating
* child widgets in `GtkWidget`Class.size_allocate().
* @returns the baseline of the @widget, or -1 if none
*/
get_allocated_baseline(): number;
/**
* Returns the height that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the height of the @widget
*/
get_allocated_height(): number;
/**
* Returns the width that has currently been allocated to the widget.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns the width of the @widget
*/
get_allocated_width(): number;
/**
* Retrieves the widgets allocation.
*
* Note, when implementing a layout widget: a widgets allocation
* will be its “adjusted” allocation, that is, the widgets parent
* typically calls [method`Gtk`.Widget.size_allocate] with an allocation,
* and that allocation is then adjusted (to handle margin
* and alignment for example) before assignment to the widget.
* [method`Gtk`.Widget.get_allocation] returns the adjusted allocation that
* was actually assigned to the widget. The adjusted allocation is
* guaranteed to be completely contained within the
* [method`Gtk`.Widget.size_allocate] allocation, however.
*
* So a layout widget is guaranteed that its children stay inside
* the assigned bounds, but not that they have exactly the bounds the
* widget assigned.
*/
get_allocation(): Gtk.Allocation;
/**
* Gets the first ancestor of the widget with type `widget_type`.
*
* For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
* gets the first `GtkBox` thats an ancestor of `widget`. No
* reference will be added to the returned widget; it should
* not be unreferenced.
*
* Note that unlike [method`Gtk`.Widget.is_ancestor], this function
* considers `widget` to be an ancestor of itself.
* @param widget_type ancestor type
* @returns the ancestor widget
*/
get_ancestor(widget_type: GObject.GType): Gtk.Widget | null;
/**
* Returns the baseline that has currently been allocated to the widget.
*
* This function is intended to be used when implementing handlers
* for the `GtkWidgetClass.snapshot()` function, and when allocating
* child widgets in `GtkWidgetClass.size_allocate()`.
* @returns the baseline of the @widget, or -1 if none
*/
get_baseline(): number;
/**
* Determines whether the input focus can enter the widget or any
* of its children.
*
* See [method`Gtk`.Widget.set_can_focus].
* @returns true if the input focus can enter @widget
*/
get_can_focus(): boolean;
/**
* Queries whether the widget can be the target of pointer events.
* @returns true if @widget can receive pointer events
*/
get_can_target(): boolean;
/**
* Gets the value set with [method`Gtk`.Widget.set_child_visible].
*
* If you feel a need to use this function, your code probably
* needs reorganization.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @returns true if the widget is mapped with the parent
*/
get_child_visible(): boolean;
/**
* Gets the clipboard object for the widget.
*
* This is a utility function to get the clipboard object for the
* display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_clipboard(): Gdk.Clipboard;
/**
* Gets the current foreground color for the widgets style.
*
* This function should only be used in snapshot
* implementations that need to do custom drawing
* with the foreground color.
*/
get_color(): Gdk.RGBA;
/**
* Returns the list of style classes applied to the widget.
* @returns a `NULL`-terminated list of css classes currently applied to @widget
*/
get_css_classes(): string[];
/**
* Returns the CSS name of the widget.
* @returns the CSS name
*/
get_css_name(): string;
/**
* Gets the cursor set on the widget.
*
* See [method`Gtk`.Widget.set_cursor] for details.
* @returns the cursor that is set on @widget
*/
get_cursor(): Gdk.Cursor | null;
/**
* Gets the reading direction for the widget.
*
* See [method`Gtk`.Widget.set_direction].
* @returns the reading direction for the widget
*/
get_direction(): Gtk.TextDirection;
/**
* Returns the widgets first child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's first child
*/
get_first_child(): Gtk.Widget | null;
/**
* Returns the focus child of the widget.
* @returns the current focus child of @widget
*/
get_focus_child(): Gtk.Widget | null;
/**
* Returns whether the widget should grab focus when it is clicked
* with the mouse.
*
* See [method`Gtk`.Widget.set_focus_on_click].
* @returns true if the widget should grab focus when it is clicked with the mouse
*/
get_focus_on_click(): boolean;
/**
* Determines whether the widget can own the input focus.
*
* See [method`Gtk`.Widget.set_focusable].
* @returns true if @widget can own the input focus
*/
get_focusable(): boolean;
/**
* Gets the font map of the widget.
*
* See [method`Gtk`.Widget.set_font_map].
* @returns the font map of @widget
*/
get_font_map(): Pango.FontMap | null;
/**
* Returns the `cairo_font_options_t` of the widget.
*
* Seee [method`Gtk`.Widget.set_font_options].
* @returns the `cairo_font_options_t` of widget
*/
get_font_options(): cairo.FontOptions | null;
/**
* Obtains the frame clock for a widget.
*
* The frame clock is a global “ticker” that can be used to drive
* animations and repaints. The most common reason to get the frame
* clock is to call [method`Gdk`.FrameClock.get_frame_time], in order
* to get a time to use for animating. For example you might record
* the start of the animation with an initial value from
* [method`Gdk`.FrameClock.get_frame_time], and then update the animation
* by calling [method`Gdk`.FrameClock.get_frame_time] again during each repaint.
*
* [method`Gdk`.FrameClock.request_phase] will result in a new frame on the
* clock, but wont necessarily repaint any widgets. To repaint a widget,
* you have to use [method`Gtk`.Widget.queue_draw] which invalidates the
* widget (thus scheduling it to receive a draw on the next frame).
* [method`Gtk`.Widget.queue_draw] will also end up requesting a frame
* on the appropriate frame clock.
*
* A widgets frame clock will not change while the widget is mapped.
* Reparenting a widget (which implies a temporary unmap) can change
* the widgets frame clock.
*
* Unrealized widgets do not have a frame clock.
* @returns the frame clock
*/
get_frame_clock(): Gdk.FrameClock | null;
/**
* Gets the horizontal alignment of the widget.
*
* For backwards compatibility reasons this method will never return
* one of the baseline alignments, but instead it will convert it to
* [enum`Gtk`.Align.fill] or [enum`Gtk`.Align.center].
*
* Baselines are not supported for horizontal alignment.
* @returns the horizontal alignment of @widget
*/
get_halign(): Gtk.Align;
/**
* Returns the current value of the `has-tooltip` property.
* @returns current value of `has-tooltip` on @widget
*/
get_has_tooltip(): boolean;
/**
* Returns the content height of the widget.
*
* This function returns the height passed to its
* size-allocate implementation, which is the height you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The height of @widget
*/
get_height(): number;
/**
* Gets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Widgets with children should use [method`Gtk`.Widget.compute_expand]
* rather than this function, to see whether any of its children,
* has the expand flag set. If any child of a widget wants to
* expand, the parent may ask to expand also.
*
* This function only looks at the widgets own hexpand flag, rather
* than computing whether the entire widget tree rooted at this widget
* wants to expand.
* @returns whether hexpand flag is set
*/
get_hexpand(): boolean;
/**
* Gets whether the `hexpand` flag has been explicitly set.
*
* If [property`Gtk`.Widget:hexpand] property is set, then it
* overrides any computed expand value based on child widgets.
* If `hexpand` is not set, then the expand value depends on
* whether any children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @returns whether hexpand has been explicitly set
*/
get_hexpand_set(): boolean;
/**
* Returns the widgets last child.
*
* This function is primarily meant for widget implementations.
* @returns the widget's last child
*/
get_last_child(): Gtk.Widget | null;
/**
* Retrieves the layout manager of the widget.
*
* See [method`Gtk`.Widget.set_layout_manager].
* @returns the layout manager of @widget
*/
get_layout_manager(): Gtk.LayoutManager | null;
/**
* Gets the value of the [property`Gtk`.Widget:limit-events] property.
*/
get_limit_events(): boolean;
/**
* Returns whether the widget is mapped.
* @returns true if the widget is mapped
*/
get_mapped(): boolean;
/**
* Gets the bottom margin of the widget.
* @returns The bottom margin of @widget
*/
get_margin_bottom(): number;
/**
* Gets the end margin of the widget.
* @returns The end margin of @widget
*/
get_margin_end(): number;
/**
* Gets the start margin of the widget.
* @returns The start margin of @widget
*/
get_margin_start(): number;
/**
* Gets the top margin of the widget.
* @returns The top margin of @widget
*/
get_margin_top(): number;
/**
* Retrieves the name of a widget.
*
* See [method`Gtk`.Widget.set_name] for the significance of widget names.
* @returns name of the widget
*/
get_name(): string;
/**
* Returns the nearest `GtkNative` ancestor of the widget.
*
* This function will return `NULL` if the widget is not
* contained inside a widget tree with a native ancestor.
*
* `GtkNative` widgets will return themselves here.
* @returns the `GtkNative` ancestor of @widget
*/
get_native(): Gtk.Native | null;
/**
* Returns the widgets next sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's next sibling
*/
get_next_sibling(): Gtk.Widget | null;
/**
* Fetches the requested opacity for the widget.
*
* See [method`Gtk`.Widget.set_opacity].
* @returns the requested opacity for this widget
*/
get_opacity(): number;
/**
* Returns the widgets overflow value.
* @returns The widget's overflow value
*/
get_overflow(): Gtk.Overflow;
/**
* Gets a `PangoContext` that is configured for the widget.
*
* The `PangoContext` will have the appropriate font map, font description,
* and base direction set.
*
* Unlike the context returned by [method`Gtk`.Widget.create_pango_context],
* this context is owned by the widget (it can be used until the screen
* for the widget changes or the widget is removed from its toplevel),
* and will be updated to match any changes to the widgets attributes.
* This can be tracked by listening to changes of the
* [property`Gtk`.Widget:root] property on the widget.
* @returns the `PangoContext` for the widget
*/
get_pango_context(): Pango.Context;
/**
* Returns the parent widget of the widget.
* @returns the parent widget of @widget
*/
get_parent(): Gtk.Widget | null;
/**
* Retrieves the minimum and natural size of a widget, taking
* into account the widgets preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
* to deduce toplevel window and menu sizes as well as child widgets in
* free-form containers such as `GtkFixed`.
*
* Handle with care. Note that the natural height of a height-for-width
* widget will generally be a smaller size than the minimum height, since
* the required height for the natural width is generally smaller than the
* required height for the minimum width.
*
* Use [method`Gtk`.Widget.measure] if you want to support baseline alignment.
*/
get_preferred_size(): [Gtk.Requisition | null, Gtk.Requisition | null];
/**
* Returns the widgets previous sibling.
*
* This function is primarily meant for widget implementations.
* @returns the widget's previous sibling
*/
get_prev_sibling(): Gtk.Widget | null;
/**
* Gets the primary clipboard of the widget.
*
* This is a utility function to get the primary clipboard object
* for the display that `widget` is using.
*
* Note that this function always works, even when `widget` is not
* realized yet.
* @returns the appropriate clipboard object
*/
get_primary_clipboard(): Gdk.Clipboard;
/**
* Determines whether the widget is realized.
* @returns true if @widget is realized
*/
get_realized(): boolean;
/**
* Determines whether the widget is always treated as the default widget
* within its toplevel when it has the focus, even if another widget
* is the default.
*
* See [method`Gtk`.Widget.set_receives_default].
* @returns true if @widget acts as the default widget when focused
*/
get_receives_default(): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
* @returns The `GtkSizeRequestMode` preferred by @widget.
*/
get_request_mode(): Gtk.SizeRequestMode;
/**
* Returns the `GtkRoot` widget of the widget.
*
* This function will return `NULL` if the widget is not contained
* inside a widget tree with a root widget.
*
* `GtkRoot` widgets will return themselves here.
* @returns the root widget of @widget
*/
get_root(): Gtk.Root | null;
/**
* Retrieves the internal scale factor that maps from window
* coordinates to the actual device pixels.
*
* On traditional systems this is 1, on high density outputs,
* it can be a higher value (typically 2).
*
* See [method`Gdk`.Surface.get_scale_factor].
*
* Note that modern systems may support *fractional* scaling,
* where the scale factor is not an integer. On such systems,
* this function will return the next higher integer value,
* but you probably want to use [method`Gdk`.Surface.get_scale]
* to get the fractional scale value.
* @returns the scale factor for @widget
*/
get_scale_factor(): number;
/**
* Returns the widgets sensitivity.
*
* This function returns the value that has been set using
* [method`Gtk`.Widget.set_sensitive]).
*
* The effective sensitivity of a widget is however determined
* by both its own and its parent widgets sensitivity.
* See [method`Gtk`.Widget.is_sensitive].
* @returns true if the widget is sensitive
*/
get_sensitive(): boolean;
/**
* Gets the settings object holding the settings used for the widget.
*
* Note that this function can only be called when the `GtkWidget`
* is attached to a toplevel, since the settings object is specific
* to a particular display. If you want to monitor the widget for
* changes in its settings, connect to the `notify::display` signal.
* @returns the relevant settings object
*/
get_settings(): Gtk.Settings;
/**
* Returns the content width or height of the widget.
*
* Which dimension is returned depends on `orientation`.
*
* This is equivalent to calling [method`Gtk`.Widget.get_width]
* for [enum`Gtk`.Orientation.horizontal] or [method`Gtk`.Widget.get_height]
* for [enum`Gtk`.Orientation.vertical], but can be used when
* writing orientation-independent code, such as when
* implementing [iface`Gtk`.Orientable] widgets.
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @param orientation the orientation to query
* @returns the size of @widget in @orientation
*/
get_size(orientation: Gtk.Orientation | null): number;
/**
* Gets the size request that was explicitly set for the widget.
*
* A value of -1 stored in `width` or `height` indicates that that
* dimension has not been set explicitly and the natural requisition
* of the widget will be used instead.
*
* See [method`Gtk`.Widget.set_size_request].
*
* To get the size a widget will actually request, call
* [method`Gtk`.Widget.measure] instead of this function.
*/
get_size_request(): [number, number];
/**
* Returns the widget state as a flag set.
*
* It is worth mentioning that the effective [flags`Gtk`.StateFlags.insensitive]
* state will be returned, that is, also based on parent insensitivity,
* even if `widget` itself is sensitive.
*
* Also note that if you are looking for a way to obtain the
* [flags`Gtk`.StateFlags] to pass to a [class`Gtk`.StyleContext]
* method, you should look at [method`Gtk`.StyleContext.get_state].
* @returns the state flags of widget
*/
get_state_flags(): Gtk.StateFlags;
/**
* Returns the style context associated to the widget.
*
* The returned object is guaranteed to be the same
* for the lifetime of `widget`.
* @returns the widgets style context
*/
get_style_context(): Gtk.StyleContext;
/**
* Fetches an object build from the template XML for `widget_type` in
* the widget.
*
* This will only report children which were previously declared
* with [method`Gtk`.WidgetClass.bind_template_child_full] or one of its
* variants.
*
* This function is only meant to be called for code which is private
* to the `widget_type` which declared the child and is meant for language
* bindings which cannot easily make use of the GObject structure offsets.
* @param widget_type The `GType` to get a template child for
* @param name ID of the child defined in the template XML
* @returns the object built in the template XML with the id @name
*/
get_template_child<T = GObject.Object>(widget_type: GObject.GType, name: string): T;
/**
* Gets the contents of the tooltip for the widget.
*
* If the tooltip has not been set using
* [method`Gtk`.Widget.set_tooltip_markup], this
* function returns `NULL`.
* @returns the tooltip text
*/
get_tooltip_markup(): string | null;
/**
* Gets the contents of the tooltip for the widget.
*
* If the `widget'`s tooltip was set using
* [method`Gtk`.Widget.set_tooltip_markup],
* this function will return the escaped text.
* @returns the tooltip text
*/
get_tooltip_text(): string | null;
/**
* Gets the vertical alignment of the widget.
* @returns the vertical alignment of @widget
*/
get_valign(): Gtk.Align;
/**
* Gets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.get_hexpand] for more detail.
* @returns whether vexpand flag is set
*/
get_vexpand(): boolean;
/**
* Gets whether the `vexpand` flag has been explicitly set.
*
* See [method`Gtk`.Widget.get_hexpand_set] for more detail.
* @returns whether vexpand has been explicitly set
*/
get_vexpand_set(): boolean;
/**
* Determines whether the widget is visible.
*
* If you want to take into account whether the widgets
* parent is also marked as visible, use
* [method`Gtk`.Widget.is_visible] instead.
*
* This function does not check if the widget is
* obscured in any way.
*
* See [method`Gtk`.Widget.set_visible].
* @returns true if the widget is visible
*/
get_visible(): boolean;
/**
* Returns the content width of the widget.
*
* This function returns the width passed to its
* size-allocate implementation, which is the width you
* should be using in [vfunc`Gtk`.Widget.snapshot].
*
* For pointer events, see [method`Gtk`.Widget.contains].
*
* To learn more about widget sizes, see the coordinate
* system [overview](coordinates.html).
* @returns The width of @widget
*/
get_width(): number;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
* @returns true if focus is now inside @widget
*/
grab_focus(): boolean;
/**
* Returns whether a style class is currently applied to the widget.
* @param css_class style class, without the leading period
* @returns true if @css_class is currently applied to @widget
*/
has_css_class(css_class: string): boolean;
/**
* Determines if the widget should show a visible indication that
* it has the global input focus.
*
* This is a convenience function that takes into account whether
* focus indication should currently be shown in the toplevel window
* of `widget`. See [method`Gtk`.Window.get_focus_visible] for more
* information about focus indication.
*
* To find out if the widget has the global input focus, use
* [method`Gtk`.Widget.has_focus].
* @returns true if the widget should display a “focus rectangle”
*/
has_visible_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
hide(): void;
/**
* Returns whether the widget is currently being destroyed.
*
* This information can sometimes be used to avoid doing
* unnecessary work.
* @returns true if @widget is being destroyed
*/
in_destruction(): boolean;
/**
* Creates and initializes child widgets defined in templates.
*
* This function must be called in the instance initializer
* for any class which assigned itself a template using
* [method`Gtk`.WidgetClass.set_template].
*
* It is important to call this function in the instance initializer
* of a widget subclass and not in `GObject.constructed()` or
* `GObject.constructor()` for two reasons:
*
* - derived widgets will assume that the composite widgets
* defined by its parent classes have been created in their
* relative instance initializers
* - when calling `g_object_new()` on a widget with composite templates,
* its important to build the composite widgets before the construct
* properties are set. Properties passed to `g_object_new()` should
* take precedence over properties set in the private template XML
*
* A good rule of thumb is to call this function as the first thing in
* an instance initialization function.
*/
init_template(): void;
/**
* Inserts an action group into the widget's actions.
*
* Children of `widget` that implement [iface`Gtk`.Actionable] can
* then be associated with actions in `group` by setting their
* “action-name” to `prefix`.`action-name`.
*
* Note that inheritance is defined for individual actions. I.e.
* even if you insert a group with prefix `prefix,` actions with
* the same prefix will still be inherited from the parent, unless
* the group contains an action with the same name.
*
* If `group` is `NULL`, a previously inserted group for `name` is
* removed from `widget`.
* @param name the prefix for actions in @group
* @param group an action group
*/
insert_action_group(name: string, group?: Gio.ActionGroup | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed after `previous_sibling,` or at the beginning if
* `previous_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_prev_sibling (widget)`
* will return `previous_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this
* function can also be used to reorder `widget` in the child widget
* list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param previous_sibling the new previous sibling of @widget
*/
insert_after(parent: Gtk.Widget, previous_sibling?: Gtk.Widget | null): void;
/**
* Sets the parent widget of the widget.
*
* In contrast to [method`Gtk`.Widget.set_parent], this function
* inserts `widget` at a specific position into the list of children
* of the `parent` widget.
*
* It will be placed before `next_sibling,` or at the end if
* `next_sibling` is `NULL`.
*
* After calling this function, `gtk_widget_get_next_sibling (widget)`
* will return `next_sibling`.
*
* If `parent` is already set as the parent widget of `widget,` this function
* can also be used to reorder `widget` in the child widget list of `parent`.
*
* This function is primarily meant for widget implementations; if you are
* just using a widget, you *must* use its own API for adding children.
* @param parent the parent widget to insert @widget into
* @param next_sibling the new next sibling of @widget
*/
insert_before(parent: Gtk.Widget, next_sibling?: Gtk.Widget | null): void;
/**
* Determines whether the widget is a descendent of `ancestor`.
* @param ancestor another `GtkWidget`
* @returns true if @ancestor contains @widget as a child, grandchild, great grandchild, etc
*/
is_ancestor(ancestor: Gtk.Widget): boolean;
/**
* Determines whether the widget can be drawn to.
*
* A widget can be drawn if it is mapped and visible.
* @returns true if @widget is drawable
*/
is_drawable(): boolean;
/**
* Determines if the widget is the focus widget within its
* toplevel.
*
* This does not mean that the [property`Gtk`.Widget:has-focus]
* property is necessarily set; [property`Gtk`.Widget:has-focus]
* will only be set if the toplevel widget additionally has the
* global input focus.
* @returns true if the widget is the focus widget
*/
is_focus(): boolean;
/**
* Returns the widgets effective sensitivity.
*
* This means it is sensitive itself and also its
* parent widget is sensitive.
* @returns true if the widget is effectively sensitive
*/
is_sensitive(): boolean;
/**
* Determines whether the widget and all its parents are marked as
* visible.
*
* This function does not check if the widget is obscured in any way.
*
* See also [method`Gtk`.Widget.get_visible] and
* [method`Gtk`.Widget.set_visible].
* @returns true if the widget and all its parents are visible
*/
is_visible(): boolean;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
* @returns true if stopping keyboard navigation is fine, false if the emitting widget should try to handle the keyboard navigation attempt in its parent widget
*/
keynav_failed(direction: Gtk.DirectionType | null): boolean;
/**
* Returns the widgets for which this widget is the target of a
* mnemonic.
*
* Typically, these widgets will be labels. See, for example,
* [method`Gtk`.Label.set_mnemonic_widget].
*
* The widgets in the list are not individually referenced.
* If you want to iterate through the list and perform actions
* involving callbacks that might destroy the widgets, you
* must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
* first, and then unref all the widgets afterwards.
* @returns the list of mnemonic labels
*/
list_mnemonic_labels(): Gtk.Widget[];
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
measure(orientation: Gtk.Orientation | null, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
* @returns true if the signal has been handled
*/
mnemonic_activate(group_cycling: boolean): boolean;
/**
* Returns a list model to track the children of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track children and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's children
*/
observe_children(): Gio.ListModel;
/**
* Returns a list model to track the event controllers of the widget.
*
* Calling this function will enable extra internal bookkeeping
* to track controllers and emit signals on the returned listmodel.
* It may slow down operations a lot.
*
* Applications should try hard to avoid calling this function
* because of the slowdowns.
* @returns a list model tracking @widget's controllers
*/
observe_controllers(): Gio.ListModel;
/**
* Finds the descendant of the widget closest to a point.
*
* The point (x, y) must be given in widget coordinates, so (0, 0)
* is assumed to be the top left of `widget'`s content area.
*
* Usually widgets will return `NULL` if the given coordinate is not
* contained in `widget` checked via [method`Gtk`.Widget.contains].
* Otherwise they will recursively try to find a child that does
* not return `NULL`. Widgets are however free to customize their
* picking algorithm.
*
* This function is used on the toplevel to determine the widget
* below the mouse cursor for purposes of hover highlighting and
* delivering events.
* @param x x coordinate to test, relative to @widget's origin
* @param y y coordinate to test, relative to @widget's origin
* @param flags flags to influence what is picked
* @returns the widget's descendant at (x, y)
*/
pick(x: number, y: number, flags: Gtk.PickFlags | null): Gtk.Widget | null;
/**
* Flags the widget for a rerun of the [vfunc`Gtk`.Widget.size_allocate]
* function.
*
* Use this function instead of [method`Gtk`.Widget.queue_resize]
* when the `widget'`s size request didn't change but it wants to
* reposition its contents.
*
* An example user of this function is [method`Gtk`.Widget.set_halign].
*
* This function is only for use in widget implementations.
*/
queue_allocate(): void;
/**
* Schedules this widget to be redrawn.
*
* The redraw will happen in the paint phase
* of the current or the next frame.
*
* This means `widget'`s [vfunc`Gtk`.Widget.snapshot]
* implementation will be called.
*/
queue_draw(): void;
/**
* Flags a widget to have its size renegotiated.
*
* This should be called when a widget for some reason has a new
* size request. For example, when you change the text in a
* [class`Gtk`.Label], the label queues a resize to ensure theres
* enough space for the new text.
*
* Note that you cannot call gtk_widget_queue_resize() on a widget
* from inside its implementation of the [vfunc`Gtk`.Widget.size_allocate]
* virtual method. Calls to gtk_widget_queue_resize() from inside
* [vfunc`Gtk`.Widget.size_allocate] will be silently ignored.
*
* This function is only for use in widget implementations.
*/
queue_resize(): void;
/**
* Removes an event controller from the widget.
*
* The removed event controller will not receive any more events,
* and should not be used again.
*
* Widgets will remove all event controllers automatically when they
* are destroyed, there is normally no need to call this function.
* @param controller an event controller
*/
remove_controller(controller: Gtk.EventController): void;
/**
* Removes a style from the widget.
*
* After this, the style of `widget` will stop matching for `css_class`.
* @param css_class style class to remove from @widget, without the leading period
*/
remove_css_class(css_class: string): void;
/**
* Removes a widget from the list of mnemonic labels for this widget.
*
* See [method`Gtk`.Widget.list_mnemonic_labels].
*
* The widget must have previously been added to the list with
* [method`Gtk`.Widget.add_mnemonic_label].
* @param label a widget that is a mnemonic label for @widget
*/
remove_mnemonic_label(label: Gtk.Widget): void;
/**
* Removes a tick callback previously registered with
* [method`Gtk`.Widget.add_tick_callback].
* @param id an ID returned by [method@Gtk.Widget.add_tick_callback]
*/
remove_tick_callback(id: number): void;
/**
* Sets whether the input focus can enter the widget or
* any of its children.
*
* Applications should set `can_focus` to false to mark a
* widget as for pointer/touch use only.
*
* Note that having `can_focus` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and focusable and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param can_focus whether the input focus can enter the widget or any of its children
*/
set_can_focus(can_focus: boolean): void;
/**
* Sets whether the widget can be the target of pointer events.
* @param can_target whether this widget should be able to receive pointer events
*/
set_can_target(can_target: boolean): void;
/**
* Sets whether the widget should be mapped along with its parent.
*
* The child visibility can be set for widget before it is added
* to a container with [method`Gtk`.Widget.set_parent], to avoid
* mapping children unnecessary before immediately unmapping them.
* However it will be reset to its default state of true when the
* widget is removed from a container.
*
* Note that changing the child visibility of a widget does not
* queue a resize on the widget. Most of the time, the size of
* a widget is computed from all visible children, whether or
* not they are mapped. If this is not the case, the container
* can queue a resize itself.
*
* This function is only useful for widget implementations
* and should never be called by an application.
* @param child_visible whether @widget should be mapped along with its parent
*/
set_child_visible(child_visible: boolean): void;
/**
* Replaces the current style classes of the widget with `classes`.
* @param classes `NULL`-terminated list of style classes
*/
set_css_classes(classes: string[]): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* If the `cursor` is `NULL`, `widget` will use the cursor
* inherited from its parent.
* @param cursor the new cursor
*/
set_cursor(cursor?: Gdk.Cursor | null): void;
/**
* Sets the cursor to be shown when the pointer hovers over
* the widget.
*
* This is a utility function that creates a cursor via
* [ctor`Gdk`.Cursor.new_from_name] and then sets it on `widget`
* with [method`Gtk`.Widget.set_cursor]. See those functions for
* details.
*
* On top of that, this function allows `name` to be `NULL`, which
* will do the same as calling [method`Gtk`.Widget.set_cursor]
* with a `NULL` cursor.
* @param name the name of the cursor
*/
set_cursor_from_name(name?: string | null): void;
/**
* Sets the reading direction on the widget.
*
* This direction controls the primary direction for widgets
* containing text, and also the direction in which the children
* of a container are packed. The ability to set the direction is
* present in order so that correct localization into languages with
* right-to-left reading directions can be done.
*
* Generally, applications will let the default reading direction
* prevail, except for widgets where the children are arranged in
* an order that is explicitly visual rather than logical (such as
* buttons for text justification).
*
* If the direction is set to [enum`Gtk`.TextDirection.none], then
* the value set by [func`Gtk`.Widget.set_default_direction] will be used.
* @param dir the new direction
*/
set_direction(dir: Gtk.TextDirection | null): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
set_focus_child(child?: Gtk.Widget | null): void;
/**
* Sets whether the widget should grab focus when it is clicked
* with the mouse.
*
* Making mouse clicks not grab focus is useful in places like
* toolbars where you dont want the keyboard focus removed from
* the main area of the application.
* @param focus_on_click whether the widget should grab focus when clicked with the mouse
*/
set_focus_on_click(focus_on_click: boolean): void;
/**
* Sets whether the widget can own the input focus.
*
* Widget implementations should set `focusable` to true in
* their init() function if they want to receive keyboard input.
*
* Note that having `focusable` be true is only one of the
* necessary conditions for being focusable. A widget must
* also be sensitive and can-focus and not have an ancestor
* that is marked as not can-focus in order to receive input
* focus.
*
* See [method`Gtk`.Widget.grab_focus] for actually setting
* the input focus on a widget.
* @param focusable whether or not @widget can own the input focus
*/
set_focusable(focusable: boolean): void;
/**
* Sets the font map to use for text rendering in the widget.
*
* The font map is the object that is used to look up fonts.
* Setting a custom font map can be useful in special situations,
* e.g. when you need to add application-specific fonts to the set
* of available fonts.
*
* When not set, the widget will inherit the font map from its parent.
* @param font_map a `PangoFontMap`
*/
set_font_map(font_map?: Pango.FontMap | null): void;
/**
* Sets the `cairo_font_options_t` used for text rendering
* in the widget.
*
* When not set, the default font options for the `GdkDisplay`
* will be used.
* @param options a `cairo_font_options_t` struct to unset any previously set default font options
*/
set_font_options(options?: cairo.FontOptions | null): void;
/**
* Sets the horizontal alignment of the widget.
* @param align the horizontal alignment
*/
set_halign(align: Gtk.Align | null): void;
/**
* Sets the `has-tooltip` property on the widget.
* @param has_tooltip whether or not @widget has a tooltip
*/
set_has_tooltip(has_tooltip: boolean): void;
/**
* Sets whether the widget would like any available extra horizontal
* space.
*
* When a user resizes a window, widgets with expand set to true generally
* receive the extra space. For example, a list or scrollable area
* or document in your window would often be set to expand.
*
* Call this function to set the expand flag if you would like your
* widget to become larger horizontally when the window has extra
* room.
*
* By default, widgets automatically expand if any of their children
* want to expand. (To see if a widget will automatically expand given
* its current children and state, call [method`Gtk`.Widget.compute_expand].
* A widget can decide how the expandability of children affects its
* own expansion by overriding the `compute_expand` virtual method on
* `GtkWidget`.).
*
* Setting hexpand explicitly with this function will override the
* automatic expand behavior.
*
* This function forces the widget to expand or not to expand,
* regardless of children. The override occurs because
* [method`Gtk`.Widget.set_hexpand] sets the hexpand-set property (see
* [method`Gtk`.Widget.set_hexpand_set]) which causes the widgets hexpand
* value to be used, rather than looking at children and widget state.
* @param expand whether to expand
*/
set_hexpand(expand: boolean): void;
/**
* Sets whether the hexpand flag will be used.
*
* The [property`Gtk`.Widget:hexpand-set] property will be set
* automatically when you call [method`Gtk`.Widget.set_hexpand]
* to set hexpand, so the most likely reason to use this function
* would be to unset an explicit expand flag.
*
* If hexpand is set, then it overrides any computed
* expand value based on child widgets. If hexpand is not
* set, then the expand value depends on whether any
* children of the widget would like to expand.
*
* There are few reasons to use this function, but its here
* for completeness and consistency.
* @param set value for hexpand-set property
*/
set_hexpand_set(set: boolean): void;
/**
* Sets the layout manager to use for measuring and allocating children
* of the widget.
* @param layout_manager a layout manager
*/
set_layout_manager(layout_manager?: Gtk.LayoutManager | null): void;
/**
* Sets whether the widget acts like a modal dialog,
* with respect to event delivery.
* @param limit_events whether to limit events
*/
set_limit_events(limit_events: boolean): void;
/**
* Sets the bottom margin of the widget.
* @param margin the bottom margin
*/
set_margin_bottom(margin: number): void;
/**
* Sets the end margin of the widget.
* @param margin the end margin
*/
set_margin_end(margin: number): void;
/**
* Sets the start margin of the widget.
* @param margin the start margin
*/
set_margin_start(margin: number): void;
/**
* Sets the top margin of the widget.
* @param margin the top margin
*/
set_margin_top(margin: number): void;
/**
* Sets a widgets name.
*
* Setting a name allows you to refer to the widget from a
* CSS file. You can apply a style to widgets with a particular name
* in the CSS file. See the documentation for the CSS syntax (on the
* same page as the docs for [class`Gtk`.StyleContext].
*
* Note that the CSS syntax has certain special characters to delimit
* and represent elements in a selector (period, #, >, *...), so using
* these will make your widget impossible to match by name. Any combination
* of alphanumeric symbols, dashes and underscores will suffice.
* @param name name for the widget
*/
set_name(name: string): void;
/**
* Requests the widget to be rendered partially transparent.
*
* An opacity of 0 is fully transparent and an opacity of 1
* is fully opaque.
*
* Opacity works on both toplevel widgets and child widgets, although
* there are some limitations: For toplevel widgets, applying opacity
* depends on the capabilities of the windowing system. On X11, this
* has any effect only on X displays with a compositing manager, see
* [method`Gdk`.Display.is_composited]. On Windows and Wayland it will
* always work, although setting a windows opacity after the window
* has been shown may cause some flicker.
*
* Note that the opacity is inherited through inclusion — if you set
* a toplevel to be partially translucent, all of its content will
* appear translucent, since it is ultimatively rendered on that
* toplevel. The opacity value itself is not inherited by child
* widgets (since that would make widgets deeper in the hierarchy
* progressively more translucent). As a consequence, [class`Gtk`.Popover]
* instances and other [iface`Gtk`.Native] widgets with their own surface
* will use their own opacity value, and thus by default appear
* non-translucent, even if they are attached to a toplevel that
* is translucent.
* @param opacity desired opacity, between 0 and 1
*/
set_opacity(opacity: number): void;
/**
* Sets how the widget treats content that is drawn outside the
* it's content area.
*
* See the definition of [enum`Gtk`.Overflow] for details.
*
* This setting is provided for widget implementations and
* should not be used by application code.
*
* The default value is [enum`Gtk`.Overflow.visible].
* @param overflow desired overflow value
*/
set_overflow(overflow: Gtk.Overflow | null): void;
/**
* Sets the parent widget of the widget.
*
* This takes care of details such as updating the state and style
* of the child to reflect its new location and resizing the parent.
* The opposite function is [method`Gtk`.Widget.unparent].
*
* This function is useful only when implementing subclasses of
* `GtkWidget`.
* @param parent parent widget
*/
set_parent(parent: Gtk.Widget): void;
/**
* Sets whether the widget will be treated as the default
* widget within its toplevel when it has the focus, even if
* another widget is the default.
* @param receives_default whether or not @widget can be a default widget
*/
set_receives_default(receives_default: boolean): void;
/**
* Sets the sensitivity of the widget.
*
* A widget is sensitive if the user can interact with it.
* Insensitive widgets are “grayed out” and the user cant
* interact with them. Insensitive widgets are known as
* “inactive”, “disabled”, or “ghosted” in some other toolkits.
* @param sensitive true to make the widget sensitive
*/
set_sensitive(sensitive: boolean): void;
/**
* Sets the minimum size of the widget.
*
* That is, the widgets size request will be at least `width`
* by `height`. You can use this function to force a widget to
* be larger than it normally would be.
*
* In most cases, [method`Gtk`.Window.set_default_size] is a better
* choice for toplevel windows than this function; setting the default
* size will still allow users to shrink the window. Setting the size
* request will force them to leave the window at least as large as
* the size request.
*
* Note the inherent danger of setting any fixed size - themes,
* translations into other languages, different fonts, and user action
* can all change the appropriate size for a given widget. So, it is
* basically impossible to hardcode a size that will always work.
*
* The size request of a widget is the smallest size a widget can
* accept while still functioning well and drawing itself correctly.
* However in some strange cases a widget may be allocated less than
* its requested size, and in many cases a widget may be allocated more
* space than it requested.
*
* If the size request in a given direction is -1 (unset), then
* the “natural” size request of the widget will be used instead.
*
* The size request set here does not include any margin from the
* properties
* [property`Gtk`.Widget:margin-start],
* [property`Gtk`.Widget:margin-end],
* [property`Gtk`.Widget:margin-top], and
* [property`Gtk`.Widget:margin-bottom], but it does include pretty
* much all other padding or border properties set by any subclass
* of `GtkWidget`.
* @param width width @widget should request, or -1 to unset
* @param height height @widget should request, or -1 to unset
*/
set_size_request(width: number, height: number): void;
/**
* Turns on flag values in the current widget state.
*
* Typical widget states are insensitive, prelighted, etc.
*
* This function accepts the values [flags`Gtk`.StateFlags.dir-ltr] and
* [flags`Gtk`.StateFlags.dir-rtl] but ignores them. If you want to set
* the widget's direction, use [method`Gtk`.Widget.set_direction].
*
* This function is for use in widget implementations.
* @param flags state flags to turn on
* @param clear whether to clear state before turning on @flags
*/
set_state_flags(flags: Gtk.StateFlags | null, clear: boolean): void;
/**
* Sets the contents of the tooltip for widget.
*
* `markup` must contain Pango markup.
*
* This function will take care of setting the
* [property`Gtk`.Widget:has-tooltip] as a side effect, and of the
* default handler for the [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_markup].
* @param markup the contents of the tooltip for @widget
*/
set_tooltip_markup(markup?: string | null): void;
/**
* Sets the contents of the tooltip for the widget.
*
* If `text` contains any markup, it will be escaped.
*
* This function will take care of setting
* [property`Gtk`.Widget:has-tooltip] as a side effect,
* and of the default handler for the
* [signal`Gtk`.Widget::query-tooltip] signal.
*
* See also [method`Gtk`.Tooltip.set_text].
* @param text the contents of the tooltip for @widget
*/
set_tooltip_text(text?: string | null): void;
/**
* Sets the vertical alignment of the widget.
* @param align the vertical alignment
*/
set_valign(align: Gtk.Align | null): void;
/**
* Sets whether the widget would like any available extra vertical
* space.
*
* See [method`Gtk`.Widget.set_hexpand] for more detail.
* @param expand whether to expand
*/
set_vexpand(expand: boolean): void;
/**
* Sets whether the vexpand flag will be used.
*
* See [method`Gtk`.Widget.set_hexpand_set] for more detail.
* @param set value for vexpand-set property
*/
set_vexpand_set(set: boolean): void;
/**
* Sets the visibility state of `widget`.
*
* Note that setting this to true doesnt mean the widget is
* actually viewable, see [method`Gtk`.Widget.get_visible].
* @param visible whether the widget should be shown or not
*/
set_visible(visible: boolean): void;
/**
* Returns whether the widget should contribute to
* the measuring and allocation of its parent.
*
* This is false for invisible children, but also
* for children that have their own surface, such
* as [class`Gtk`.Popover] instances.
* @returns true if child should be included in measuring and allocating
*/
should_layout(): boolean;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
show(): void;
/**
* Allocates widget with a transformation that translates
* the origin to the position in `allocation`.
*
* This is a simple form of [method`Gtk`.Widget.allocate].
* @param allocation position and size to be allocated to @widget
* @param baseline the baseline of the child, or -1
*/
size_allocate(allocation: Gtk.Allocation, baseline: number): void;
/**
* Snapshots a child of the widget.
*
* When a widget receives a call to the snapshot function,
* it must send synthetic [vfunc`Gtk`.Widget.snapshot] calls
* to all children. This function provides a convenient way
* of doing this. A widget, when it receives a call to its
* [vfunc`Gtk`.Widget.snapshot] function, calls
* gtk_widget_snapshot_child() once for each child, passing in
* the `snapshot` the widget received.
*
* This function takes care of translating the origin of `snapshot,`
* and deciding whether the child needs to be snapshot.
*
* It does nothing for children that implement `GtkNative`.
* @param child a child of @widget
* @param snapshot snapshot as passed to the widget. In particular, no calls to [method@Gtk.Snapshot.translate] or other transform calls should have been made
*/
snapshot_child(child: Gtk.Widget, snapshot: Gtk.Snapshot): void;
/**
* Translates coordinates relative to `src_widget`s allocation
* to coordinates relative to `dest_widget`s allocations.
*
* In order to perform this operation, both widget must share
* a common ancestor. If that is not the case, `dest_x` and `dest_y`
* are set to 0 and false is returned.
* @param dest_widget another widget
* @param src_x X position in widget coordinates of @src_widget
* @param src_y Y position in widget coordinates of @src_widget
* @returns true if @src_widget and @dest_widget have a common ancestor, false otherwise
*/
translate_coordinates(dest_widget: Gtk.Widget, src_x: number, src_y: number): [boolean, number, number];
/**
* Triggers a tooltip query on the display of the widget.
*/
trigger_tooltip_query(): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
unmap(): void;
/**
* Removes `widget` from its parent.
*
* This function is only for use in widget implementations,
* typically in dispose.
*/
unparent(): void;
/**
* Turns off flag values for the current widget state.
*
* See [method`Gtk`.Widget.set_state_flags].
*
* This function is for use in widget implementations.
* @param flags state flags to turn off
*/
unset_state_flags(flags: Gtk.StateFlags | null): void;
/**
* Computes whether a container should give this
* widget extra space when possible.
* @param hexpand_p
* @param vexpand_p
*/
vfunc_compute_expand(hexpand_p: boolean, vexpand_p: boolean): void;
/**
* Tests if a given point is contained in the widget.
*
* The coordinates for (x, y) must be in widget coordinates, so
* (0, 0) is assumed to be the top left of `widget'`s content area.
* @param x X coordinate to test, relative to @widget's origin
* @param y Y coordinate to test, relative to @widget's origin
*/
vfunc_contains(x: number, y: number): boolean;
/**
* Vfunc called when the CSS used by widget was changed. Widgets
* should then discard their caches that depend on CSS and queue resizes or
* redraws accordingly. The default implementation will take care of this for
* all the default CSS properties, so implementations must chain up.
* @param change
*/
vfunc_css_changed(change: Gtk.CssStyleChange): void;
/**
* Signal emitted when the text direction of a
* widget changes.
* @param previous_direction
*/
vfunc_direction_changed(previous_direction: Gtk.TextDirection): void;
/**
* Vfunc for gtk_widget_child_focus()
* @param direction
*/
vfunc_focus(direction: Gtk.DirectionType): boolean;
/**
* Gets whether the widget prefers a height-for-width layout
* or a width-for-height layout.
*
* Single-child widgets generally propagate the preference of
* their child, more complex widgets need to request something
* either in context of their children or in context of their
* allocation capabilities.
*/
vfunc_get_request_mode(): Gtk.SizeRequestMode;
/**
* Causes `widget` to have the keyboard focus for the window
* that it belongs to.
*
* If `widget` is not focusable, or its [vfunc`Gtk`.Widget.grab_focus]
* implementation cannot transfer the focus to a descendant of `widget`
* that is focusable, it will not take focus and false will be returned.
*
* Calling [method`Gtk`.Widget.grab_focus] on an already focused widget
* is allowed, should not have an effect, and return true.
*/
vfunc_grab_focus(): boolean;
/**
* Reverses the effects of [method.Gtk.Widget.show].
*
* This is causing the widget to be hidden (invisible to the user).
*/
vfunc_hide(): void;
/**
* Emits the [signal`Gtk`.Widget::keynav-failed] signal on the widget.
*
* This function should be called whenever keyboard navigation
* within a single widget hits a boundary.
*
* The return value of this function should be interpreted
* in a way similar to the return value of
* [method`Gtk`.Widget.child_focus]. When true is returned,
* stay in the widget, the failed keyboard navigation is ok
* and/or there is nowhere we can/should move the focus to.
* When false is returned, the caller should continue with
* keyboard navigation outside the widget, e.g. by calling
* [method`Gtk`.Widget.child_focus] on the widgets toplevel.
*
* The default [signal`Gtk`.Widget::keynav-failed] handler returns
* false for [enum`Gtk`.DirectionType.tab-forward] and
* [enum`Gtk`.DirectionType.tab-backward]. For the other values
* of [enum`Gtk`.DirectionType] it returns true.
*
* Whenever the default handler returns true, it also calls
* [method`Gtk`.Widget.error_bell] to notify the user of the
* failed keyboard navigation.
*
* A use case for providing an own implementation of `::keynav-failed`
* (either by connecting to it or by overriding it) would be a row of
* [class`Gtk`.Entry] widgets where the user should be able to navigate
* the entire row with the cursor keys, as e.g. known from user
* interfaces that require entering license keys.
* @param direction direction of focus movement
*/
vfunc_keynav_failed(direction: Gtk.DirectionType): boolean;
/**
* Causes a widget to be mapped if it isnt already.
*
* This function is only for use in widget implementations.
*/
vfunc_map(): void;
/**
* Measures `widget` in the orientation `orientation` and for the given `for_size`.
*
* As an example, if `orientation` is %GTK_ORIENTATION_HORIZONTAL and `for_size`
* is 300, this functions will compute the minimum and natural width of `widget`
* if it is allocated at a height of 300 pixels.
*
* See [GtkWidgets geometry management section](class.Widget.html#height-for-width-geometry-management) for
* a more details on implementing `GtkWidgetClass.measure()`.
* @param orientation the orientation to measure
* @param for_size Size for the opposite of @orientation, i.e. if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL case is analogous. This way, both height-for-width and width-for-height requests can be implemented. If no size is known, -1 can be passed.
*/
vfunc_measure(orientation: Gtk.Orientation, for_size: number): [number, number, number, number];
/**
* Emits the [signal`Gtk`.Widget::mnemonic-activate] signal.
* @param group_cycling true if there are other widgets with the same mnemonic
*/
vfunc_mnemonic_activate(group_cycling: boolean): boolean;
/**
* Signal emitted when a change of focus is requested
* @param direction
*/
vfunc_move_focus(direction: Gtk.DirectionType): void;
/**
* Signal emitted when “has-tooltip” is %TRUE and the
* hover timeout has expired with the cursor hovering “above”
* widget; or emitted when widget got focus in keyboard mode.
* @param x
* @param y
* @param keyboard_tooltip
* @param tooltip
*/
vfunc_query_tooltip(x: number, y: number, keyboard_tooltip: boolean, tooltip: Gtk.Tooltip): boolean;
/**
* Creates the GDK resources associated with a widget.
*
* Normally realization happens implicitly; if you show a widget
* and all its parent containers, then the widget will be realized
* and mapped automatically.
*
* Realizing a widget requires all the widgets parent widgets to be
* realized; calling this function realizes the widgets parents
* in addition to `widget` itself. If a widget is not yet inside a
* toplevel window when you realize it, bad things will happen.
*
* This function is primarily used in widget implementations, and
* isnt very useful otherwise. Many times when you think you might
* need it, a better approach is to connect to a signal that will be
* called after the widget is realized automatically, such as
* [signal`Gtk`.Widget::realize].
*/
vfunc_realize(): void;
/**
* Called when the widget gets added to a `GtkRoot` widget. Must
* chain up
*/
vfunc_root(): void;
/**
* Set the focus child of the widget.
*
* This function is only suitable for widget implementations.
* If you want a certain widget to get the input focus, call
* [method`Gtk`.Widget.grab_focus] on it.
* @param child a direct child widget of @widget or `NULL` to unset the focus child
*/
vfunc_set_focus_child(child?: Gtk.Widget | null): void;
/**
* Flags a widget to be displayed.
*
* Any widget that isnt shown will not appear on the screen.
*
* Remember that you have to show the containers containing a widget,
* in addition to the widget itself, before it will appear onscreen.
*
* When a toplevel widget is shown, it is immediately realized and
* mapped; other shown widgets are realized and mapped when their
* toplevel widget is realized and mapped.
*/
vfunc_show(): void;
/**
* Called to set the allocation, if the widget does
* not have a layout manager.
* @param width
* @param height
* @param baseline
*/
vfunc_size_allocate(width: number, height: number, baseline: number): void;
/**
* Vfunc called when a new snapshot of the widget has to be taken.
* @param snapshot
*/
vfunc_snapshot(snapshot: Gtk.Snapshot): void;
/**
* Signal emitted when the widget state changes,
* see gtk_widget_get_state_flags().
* @param previous_state_flags
*/
vfunc_state_flags_changed(previous_state_flags: Gtk.StateFlags): void;
/**
* Emitted when a system setting was changed. Must chain up.
* @param settings
*/
vfunc_system_setting_changed(settings: Gtk.SystemSetting): void;
/**
* Causes a widget to be unmapped if its currently mapped.
*
* This function is only for use in widget implementations.
*/
vfunc_unmap(): void;
/**
* Causes a widget to be unrealized.
*
* This frees all GDK resources associated with the widget.
*
* This function is only useful in widget implementations.
*/
vfunc_unrealize(): void;
/**
* Called when the widget is about to be removed from its
* `GtkRoot` widget. Must chain up
*/
vfunc_unroot(): void;
}
namespace WindowTitle {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps {
subtitle: string;
title: string;
}
}
/**
* A helper widget for setting a window's title and subtitle.
*
* <picture>
* <source srcset="window-title-dark.png" media="(prefers-color-scheme: dark)">
* <img src="window-title.png" alt="window-title">
* </picture>
*
* `AdwWindowTitle` shows a title and subtitle. It's intended to be used as the
* title child of [class`Gtk`.HeaderBar] or [class`HeaderBar]`.
*
* ## CSS nodes
*
* `AdwWindowTitle` has a single CSS node with name `windowtitle`.
*/
class WindowTitle extends Gtk.Widget implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget {
static $gtype: GObject.GType<WindowTitle>;
// Properties
/**
* The subtitle to display.
*
* The subtitle should give the user additional details.
*/
get subtitle(): string;
set subtitle(val: string);
/**
* The title to display.
*
* The title typically identifies the current view or content item, and
* generally does not use the application name.
*/
get title(): string;
set title(val: string);
// Constructors
constructor(properties?: Partial<WindowTitle.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](title: string, subtitle: string): WindowTitle;
// Methods
/**
* Gets the subtitle of `self`.
* @returns the subtitle
*/
get_subtitle(): string;
/**
* Gets the title of `self`.
* @returns the title
*/
get_title(): string;
/**
* Sets the subtitle of `self`.
*
* The subtitle should give the user additional details.
* @param subtitle a subtitle
*/
set_subtitle(subtitle: string): void;
/**
* Sets the title of `self`.
*
* The title typically identifies the current view or content item, and
* generally does not use the application name.
* @param title a title
*/
set_title(title: string): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: 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 WrapBox {
// Constructor properties interface
interface ConstructorProps
extends Gtk.Widget.ConstructorProps,
Gtk.Accessible.ConstructorProps,
Gtk.Buildable.ConstructorProps,
Gtk.ConstraintTarget.ConstructorProps,
Gtk.Orientable.ConstructorProps {
align: number;
child_spacing: number;
childSpacing: number;
child_spacing_unit: LengthUnit;
childSpacingUnit: LengthUnit;
justify: JustifyMode;
justify_last_line: boolean;
justifyLastLine: boolean;
line_homogeneous: boolean;
lineHomogeneous: boolean;
line_spacing: number;
lineSpacing: number;
line_spacing_unit: LengthUnit;
lineSpacingUnit: LengthUnit;
natural_line_length: number;
naturalLineLength: number;
natural_line_length_unit: LengthUnit;
naturalLineLengthUnit: LengthUnit;
pack_direction: PackDirection;
packDirection: PackDirection;
wrap_policy: WrapPolicy;
wrapPolicy: WrapPolicy;
wrap_reverse: boolean;
wrapReverse: boolean;
}
}
/**
* A box-like widget that can wrap into multiple lines.
*
* <picture>
* <source srcset="wrap-box-dark.png" media="(prefers-color-scheme: dark)">
* <img src="wrap-box.png" alt="wrap-box">
* </picture>
*
* `AdwWrapBox` is similar to [class`Gtk`.Box], but can wrap lines when the
* widgets cannot fit otherwise. Unlike [class`Gtk`.FlowBox], the children aren't
* arranged into a grid and behave more like words in a wrapping label.
*
* Like `GtkBox`, `AdwWrapBox` is orientable and has spacing:
*
* - [property`WrapBox:`child-spacing] between children in the same line;
* - [property`WrapBox:`line-spacing] between lines.
*
* ::: note
* Unlike `GtkBox`, `AdwWrapBox` cannot follow the CSS `border-spacing`
* property.
*
* Use the [property`WrapBox:`natural-line-length] property to determine the
* layout's natural size, e.g. when using it in a [class`Gtk`.Popover].
*
* Normally, a horizontal `AdwWrapBox` wraps left to right and top to bottom
* for left-to-right languages. Both of these directions can be reversed, using
* the [property`WrapBox:`pack-direction] and [property`WrapBox:`wrap-reverse]
* properties. Additionally, the alignment of each line can be controlled with
* the [property`WrapBox:`align] property.
*
* Lines can be justified using the [property`WrapBox:`justify] property, filling
* the entire line by either increasing child size or spacing depending on the
* value. Set [property`WrapBox:`justify-last-line] to justify the last line as
* well.
*
* By default, `AdwWrapBox` wraps as soon as the previous line cannot fit any
* more children without shrinking them past their natural size. Set
* [property`WrapBox:`wrap-policy] to [enum`Adw`.WrapPolicy.MINIMUM] to only wrap
* once all the children in the previous line have been shrunk to their minimum
* size.
*
* To make each line take the same amount of space, set
* [property`WrapBox:`line-homogeneous] to `TRUE`.
*
* Spacing and natural line length can scale with the text scale factor, use the
* [property`WrapBox:`child-spacing-unit], [property`WrapBox:`line-spacing-unit]
* and/or [property`WrapBox:`natural-line-length-unit] properties to enable that
* behavior.
*
* See [class`WrapLayout]`.
*
* ## CSS nodes
*
* `AdwWrapBox` uses a single CSS node with name `wrap-box`.
*
* ## Accessibility
*
* `AdwWrapBox` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.
*/
class WrapBox
extends Gtk.Widget
implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Orientable
{
static $gtype: GObject.GType<WrapBox>;
// Properties
/**
* The alignment of the children within each line.
*
* 0 means the children are placed at the start of the line, 1 means they are
* placed at the end of the line. 0.5 means they are placed in the middle of
* the line.
*
* Alignment is only used when [property`WrapBox:`justify] is set to
* `ADW_JUSTIFY_NONE`, or on the last line when the
* [property`WrapBox:`justify-last-line] is `FALSE`.
*/
get align(): number;
set align(val: number);
/**
* The spacing between widgets on the same line.
*
* See [property`WrapBox:`child-spacing-unit].
*/
get child_spacing(): number;
set child_spacing(val: number);
/**
* The spacing between widgets on the same line.
*
* See [property`WrapBox:`child-spacing-unit].
*/
get childSpacing(): number;
set childSpacing(val: number);
/**
* The length unit for child spacing.
*
* Allows the spacing to vary depending on the text scale factor.
*
* See [property`WrapBox:`child-spacing].
*/
get child_spacing_unit(): LengthUnit;
set child_spacing_unit(val: LengthUnit);
/**
* The length unit for child spacing.
*
* Allows the spacing to vary depending on the text scale factor.
*
* See [property`WrapBox:`child-spacing].
*/
get childSpacingUnit(): LengthUnit;
set childSpacingUnit(val: LengthUnit);
/**
* Determines whether and how each complete line should be stretched to fill
* the entire widget.
*
* If set to `ADW_JUSTIFY_FILL`, each widget in the line will be stretched,
* keeping consistent spacing, so that the line fills the entire widget.
*
* If set to `ADW_JUSTIFY_SPREAD`, the spacing between widgets will be
* increased, keeping widget sizes intact. The first and last widget will be
* aligned with the beginning and end of the line. If the line only contains
* a single widget, it will be stretched regardless.
*
* If set to `ADW_JUSTIFY_NONE`, the line will not be stretched and the
* children will be placed together within the line, according to
* [property`WrapBox:`align].
*
* By default this doesn't affect the last line, as it will be incomplete. Use
* [property`WrapBox:`justify-last-line] to justify it as well.
*/
get justify(): JustifyMode;
set justify(val: JustifyMode);
/**
* Whether the last line should be stretched to fill the entire widget.
*
* See [property`WrapBox:`justify].
*/
get justify_last_line(): boolean;
set justify_last_line(val: boolean);
/**
* Whether the last line should be stretched to fill the entire widget.
*
* See [property`WrapBox:`justify].
*/
get justifyLastLine(): boolean;
set justifyLastLine(val: boolean);
/**
* Whether all lines should take the same amount of space.
*/
get line_homogeneous(): boolean;
set line_homogeneous(val: boolean);
/**
* Whether all lines should take the same amount of space.
*/
get lineHomogeneous(): boolean;
set lineHomogeneous(val: boolean);
/**
* The spacing between lines.
*
* See [property`WrapBox:`line-spacing-unit].
*/
get line_spacing(): number;
set line_spacing(val: number);
/**
* The spacing between lines.
*
* See [property`WrapBox:`line-spacing-unit].
*/
get lineSpacing(): number;
set lineSpacing(val: number);
/**
* The length unit for line spacing.
*
* Allows the spacing to vary depending on the text scale factor.
*
* See [property`WrapBox:`line-spacing].
*/
get line_spacing_unit(): LengthUnit;
set line_spacing_unit(val: LengthUnit);
/**
* The length unit for line spacing.
*
* Allows the spacing to vary depending on the text scale factor.
*
* See [property`WrapBox:`line-spacing].
*/
get lineSpacingUnit(): LengthUnit;
set lineSpacingUnit(val: LengthUnit);
/**
* Determines the natural size for each line.
*
* It should be used to limit the line lengths, for example when used in
* popovers.
*
* See [property`WrapBox:`natural-line-length-unit].
*/
get natural_line_length(): number;
set natural_line_length(val: number);
/**
* Determines the natural size for each line.
*
* It should be used to limit the line lengths, for example when used in
* popovers.
*
* See [property`WrapBox:`natural-line-length-unit].
*/
get naturalLineLength(): number;
set naturalLineLength(val: number);
/**
* The length unit for natural line length.
*
* Allows the length to vary depending on the text scale factor.
*
* See [property`WrapBox:`natural-line-length].
*/
get natural_line_length_unit(): LengthUnit;
set natural_line_length_unit(val: LengthUnit);
/**
* The length unit for natural line length.
*
* Allows the length to vary depending on the text scale factor.
*
* See [property`WrapBox:`natural-line-length].
*/
get naturalLineLengthUnit(): LengthUnit;
set naturalLineLengthUnit(val: LengthUnit);
/**
* The direction children are packed in each line.
*/
get pack_direction(): PackDirection;
set pack_direction(val: PackDirection);
/**
* The direction children are packed in each line.
*/
get packDirection(): PackDirection;
set packDirection(val: PackDirection);
/**
* The policy for line wrapping.
*
* + If set to `ADW_WRAP_NATURAL`, the box will wrap to the next line as soon as
* the previous line cannot fit any more children without shrinking them past
* their natural size.
*
* If set to `ADW_WRAP_MINIMUM`, the box will try to fit as many children into
* each line as possible, shrinking them down to their minimum size before
* wrapping to the next line.
*/
get wrap_policy(): WrapPolicy;
set wrap_policy(val: WrapPolicy);
/**
* The policy for line wrapping.
*
* + If set to `ADW_WRAP_NATURAL`, the box will wrap to the next line as soon as
* the previous line cannot fit any more children without shrinking them past
* their natural size.
*
* If set to `ADW_WRAP_MINIMUM`, the box will try to fit as many children into
* each line as possible, shrinking them down to their minimum size before
* wrapping to the next line.
*/
get wrapPolicy(): WrapPolicy;
set wrapPolicy(val: WrapPolicy);
/**
* Whether wrap direction should be reversed.
*
* By default, lines wrap downwards in a horizontal box, and towards the end
* in a vertical box. If set to `TRUE`, they wrap upwards or towards the start
* respectively.
*/
get wrap_reverse(): boolean;
set wrap_reverse(val: boolean);
/**
* Whether wrap direction should be reversed.
*
* By default, lines wrap downwards in a horizontal box, and towards the end
* in a vertical box. If set to `TRUE`, they wrap upwards or towards the start
* respectively.
*/
get wrapReverse(): boolean;
set wrapReverse(val: boolean);
// Constructors
constructor(properties?: Partial<WrapBox.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): WrapBox;
// Methods
/**
* Adds `child` as the last child to `self`.
* @param child the widget to append
*/
append(child: Gtk.Widget): void;
/**
* Gets the alignment of the children within each line.
* @returns the child alignment
*/
get_align(): number;
/**
* Gets spacing between widgets on the same line.
* @returns spacing between widgets on the same line
*/
get_child_spacing(): number;
/**
* Gets the length unit for child spacing.
* @returns the length unit
*/
get_child_spacing_unit(): LengthUnit;
/**
* Gets whether and how each complete line is stretched to fill the entire widget.
* @returns the justify mode
*/
get_justify(): JustifyMode;
/**
* Gets whether the last line should be stretched to fill the entire widget.
* @returns whether the last line is justified
*/
get_justify_last_line(): boolean;
/**
* Gets whether all lines should take the same amount of space.
* @returns whether lines should be homogeneous
*/
get_line_homogeneous(): boolean;
/**
* Gets the spacing between lines.
*
* See [property`WrapBox:`line-spacing-unit].
* @returns the line spacing
*/
get_line_spacing(): number;
/**
* Gets the length unit for line spacing.
* @returns the length unit
*/
get_line_spacing_unit(): LengthUnit;
/**
* Gets the natural size for each line.
* @returns the natural length
*/
get_natural_line_length(): number;
/**
* Gets the length unit for line spacing.
* @returns the length unit
*/
get_natural_line_length_unit(): LengthUnit;
/**
* Gets the direction children are packed in each line.
* @returns the line direction
*/
get_pack_direction(): PackDirection;
/**
* Gets the policy for line wrapping.
* @returns the wrap policy
*/
get_wrap_policy(): WrapPolicy;
/**
* Gets whether wrap direction is reversed.
* @returns whether wrap direction is reversed
*/
get_wrap_reverse(): boolean;
/**
* Inserts `child` in the position after `sibling` in the list of `self` children.
*
* If `sibling` is `NULL`, inserts `child` at the first position.
* @param child the widget to insert
* @param sibling the sibling after which to insert @child
*/
insert_child_after(child: Gtk.Widget, sibling?: Gtk.Widget | null): void;
/**
* Adds `child` as the first child to `self`.
* @param child the widget to prepend
*/
prepend(child: Gtk.Widget): void;
/**
* Removes a child widget from `self`.
*
* The child must have been added before with [method`Adw`.WrapBox.append],
* [method`Adw`.WrapBox.prepend], or [method`Adw`.WrapBox.insert_child_after].
* @param child the child to remove
*/
remove(child: Gtk.Widget): void;
/**
* Moves `child` to the position after `sibling` in the list of `self` children.
*
* If `sibling` is `NULL`, moves `child` to the first position.
* @param child the widget to move, must be a child of @self
* @param sibling the sibling to move @child after
*/
reorder_child_after(child: Gtk.Widget, sibling?: Gtk.Widget | null): void;
/**
* Sets the alignment of the children within each line.
*
* 0 means the children are placed at the start of the line, 1 means they are
* placed at the end of the line. 0.5 means they are placed in the middle of the
* line.
*
* Alignment is only used when [property`WrapBox:`justify] is set to
* `ADW_JUSTIFY_NONE`, or on the last line when the
* [property`WrapBox:`justify-last-line] is `FALSE`.
* @param align the child alignment
*/
set_align(align: number): void;
/**
* Sets the spacing between widgets on the same line.
*
* See [property`WrapBox:`child-spacing-unit].
* @param child_spacing the child spacing
*/
set_child_spacing(child_spacing: number): void;
/**
* Sets the length unit for child spacing.
*
* Allows the spacing to vary depending on the text scale factor.
*
* See [property`WrapBox:`child-spacing].
* @param unit the length unit
*/
set_child_spacing_unit(unit: LengthUnit | null): void;
/**
* Determines whether and how each complete line should be stretched to fill
* the entire widget.
*
* If set to `ADW_JUSTIFY_FILL`, each widget in the line will be stretched,
* keeping consistent spacing, so that the line fills the entire widget.
*
* If set to `ADW_JUSTIFY_SPREAD`, the spacing between widgets will be
* increased, keeping widget sizes intact. The first and last widget will be
* aligned with the beginning and end of the line. If the line only contains a
* single widget, it will be stretched regardless.
*
* If set to `ADW_JUSTIFY_NONE`, the line will not be stretched and the children
* will be placed together within the line, according to
* [property`WrapBox:`align].
*
* By default this doesn't affect the last line, as it will be incomplete. Use
* [property`WrapBox:`justify-last-line] to justify it as well.
* @param justify the justify mode
*/
set_justify(justify: JustifyMode | null): void;
/**
* Sets whether the last line should be stretched to fill the entire widget.
*
* See [property`WrapBox:`justify].
* @param justify_last_line whether to justify the last line
*/
set_justify_last_line(justify_last_line: boolean): void;
/**
* Sets whether all lines should take the same amount of space.
* @param homogeneous whether lines should be homogeneous
*/
set_line_homogeneous(homogeneous: boolean): void;
/**
* Sets the spacing between lines.
* @param line_spacing the line spacing
*/
set_line_spacing(line_spacing: number): void;
/**
* Sets the length unit for line spacing.
*
* Allows the spacing to vary depending on the text scale factor.
*
* See [property`WrapBox:`line-spacing].
* @param unit the length unit
*/
set_line_spacing_unit(unit: LengthUnit | null): void;
/**
* Sets the natural size for each line.
*
* It should be used to limit the line lengths, for example when used in
* popovers.
*
* See [property`WrapBox:`natural-line-length-unit].
* @param natural_line_length the natural length
*/
set_natural_line_length(natural_line_length: number): void;
/**
* Sets the length unit for natural line length.
*
* Allows the length to vary depending on the text scale factor.
*
* See [property`WrapBox:`natural-line-length].
* @param unit the length unit
*/
set_natural_line_length_unit(unit: LengthUnit | null): void;
/**
* Sets the direction children are packed in each line.
* @param pack_direction the new line direction
*/
set_pack_direction(pack_direction: PackDirection | null): void;
/**
* Sets the policy for line wrapping.
*
* If set to `ADW_WRAP_NATURAL`, the box will wrap to the next line as soon as
* the previous line cannot fit any more children without shrinking them past
* their natural size.
*
* If set to `ADW_WRAP_MINIMUM`, the box will try to fit as many children into
* each line as possible, shrinking them down to their minimum size before
* wrapping to the next line.
* @param wrap_policy the new wrap policy
*/
set_wrap_policy(wrap_policy: WrapPolicy | null): void;
/**
* Sets whether wrap direction should be reversed.
*
* By default, lines wrap downwards in a horizontal box, and towards the end
* in a vertical box. If set to `TRUE`, they wrap upwards or towards the start
* respectively.
* @param wrap_reverse whether to reverse wrap direction
*/
set_wrap_reverse(wrap_reverse: boolean): void;
// Inherited properties
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessible_role(): Gtk.AccessibleRole;
set accessible_role(val: Gtk.AccessibleRole);
/**
* The accessible role of the given `GtkAccessible` implementation.
*
* The accessible role cannot be changed once set.
*/
get accessibleRole(): Gtk.AccessibleRole;
set accessibleRole(val: Gtk.AccessibleRole);
/**
* The orientation of the orientable.
*/
get orientation(): Gtk.Orientation;
set orientation(val: Gtk.Orientation);
// Inherited methods
/**
* Requests the user's screen reader to announce the given message.
*
* This kind of notification is useful for messages that
* either have only a visual representation or that are not
* exposed visually at all, e.g. a notification about a
* successful operation.
*
* Also, by using this API, you can ensure that the message
* does not interrupts the user's current screen reader output.
* @param message the string to announce
* @param priority the priority of the announcement
*/
announce(message: string, priority: Gtk.AccessibleAnnouncementPriority | null): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
* @returns the accessible parent
*/
get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the accessible role of an accessible object.
* @returns the accessible role
*/
get_accessible_role(): Gtk.AccessibleRole;
/**
* Retrieves the implementation for the given accessible object.
* @returns the accessible implementation object
*/
get_at_context(): Gtk.ATContext;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
* @returns true if the bounds are valid, and false otherwise
*/
get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
* @returns the first accessible child
*/
get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
* @returns the next accessible sibling
*/
get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
* @returns the value of state for the accessible
*/
get_platform_state(state: Gtk.AccessiblePlatformState | null): boolean;
/**
* Resets the accessible property to its default value.
* @param property the accessible property
*/
reset_property(property: Gtk.AccessibleProperty | null): void;
/**
* Resets the accessible relation to its default value.
* @param relation the accessible relation
*/
reset_relation(relation: Gtk.AccessibleRelation | null): void;
/**
* Resets the accessible state to its default value.
* @param state the accessible state
*/
reset_state(state: Gtk.AccessibleState | null): void;
/**
* Sets the parent and sibling of an accessible object.
*
* This function is meant to be used by accessible implementations that are
* not part of the widget hierarchy, and but act as a logical bridge between
* widgets. For instance, if a widget creates an object that holds metadata
* for each child, and you want that object to implement the `GtkAccessible`
* interface, you will use this function to ensure that the parent of each
* child widget is the metadata object, and the parent of each metadata
* object is the container widget.
* @param parent the parent accessible object
* @param next_sibling the sibling accessible object
*/
set_accessible_parent(parent?: Gtk.Accessible | null, next_sibling?: Gtk.Accessible | null): void;
/**
* Updates the next accessible sibling.
*
* That might be useful when a new child of a custom accessible
* is created, and it needs to be linked to a previous child.
* @param new_sibling the new next accessible sibling to set
*/
update_next_accessible_sibling(new_sibling?: Gtk.Accessible | null): void;
/**
* Informs ATs that the platform state has changed.
*
* This function should be used by `GtkAccessible` implementations that
* have a platform state but are not widgets. Widgets handle platform
* states automatically.
* @param state the platform state to update
*/
update_platform_state(state: Gtk.AccessiblePlatformState | null): void;
/**
* Updates an array of accessible properties.
*
* This function should be called by `GtkWidget` types whenever an accessible
* property change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param properties an array of accessible properties
* @param values an array of `GValues`, one for each property
*/
update_property(properties: Gtk.AccessibleProperty[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible relations.
*
* This function should be called by `GtkWidget` types whenever an accessible
* relation change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param relations an array of accessible relations
* @param values an array of `GValues`, one for each relation
*/
update_relation(relations: Gtk.AccessibleRelation[] | null, values: (GObject.Value | any)[]): void;
/**
* Updates an array of accessible states.
*
* This function should be called by `GtkWidget` types whenever an accessible
* state change must be communicated to assistive technologies.
*
* This function is meant to be used by language bindings.
* @param states an array of accessible states
* @param values an array of `GValues`, one for each state
*/
update_state(states: Gtk.AccessibleState[] | null, values: (GObject.Value | any)[]): void;
/**
* Retrieves the accessible parent for an accessible object.
*
* This function returns `NULL` for top level widgets.
*/
vfunc_get_accessible_parent(): Gtk.Accessible | null;
/**
* Retrieves the implementation for the given accessible object.
*/
vfunc_get_at_context(): Gtk.ATContext | null;
/**
* Queries the coordinates and dimensions of this accessible
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get the bounds from an ignored
* child widget.
*/
vfunc_get_bounds(): [boolean, number, number, number, number];
/**
* Retrieves the first accessible child of an accessible object.
*/
vfunc_get_first_accessible_child(): Gtk.Accessible | null;
/**
* Retrieves the next accessible sibling of an accessible object
*/
vfunc_get_next_accessible_sibling(): Gtk.Accessible | null;
/**
* Queries a platform state, such as focus.
*
* This functionality can be overridden by `GtkAccessible`
* implementations, e.g. to get platform state from an ignored
* child widget, as is the case for `GtkText` wrappers.
* @param state platform state to query
*/
vfunc_get_platform_state(state: Gtk.AccessiblePlatformState): boolean;
/**
* Gets the ID of the `buildable` object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the `buildable`.
* @returns the ID of the buildable object
*/
get_buildable_id(): string | null;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Called for each unknown element under `<child>`.
* @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, Gtk.BuildableParser, any];
/**
* The getter corresponding to `set_id`. Implement this
* if you implement `set_id`.
*/
vfunc_get_id(): string;
/**
* Retrieves the internal child called `childname` of the `buildable` object.
* @param builder a `GtkBuilder`
* @param childname name of child
*/
vfunc_get_internal_child<T = GObject.Object>(builder: Gtk.Builder, childname: string): T;
/**
* Called when a builder finishes the parsing
* of a UI definition. It is normally not necessary to implement this,
* unless you need to perform special cleanup actions. `GtkWindow` sets
* the `GtkWidget:visible` property here.
* @param builder
*/
vfunc_parser_finished(builder: Gtk.Builder): void;
/**
* Sets a property of a buildable object.
* It is normally not necessary to implement this, g_object_set_property()
* is used by default. `GtkWindow` implements this to delay showing itself
* (i.e. setting the [property`Gtk`.Widget:visible] property) until the whole
* interface is created.
* @param builder
* @param name
* @param value
*/
vfunc_set_buildable_property(builder: Gtk.Builder, name: string, value: GObject.Value | any): void;
/**
* Stores the id attribute given in the `GtkBuilder` UI definition.
* `GtkWidget` stores the name as object data. Implement this method if your
* object has some notion of “ID” and it makes sense to map the XML id
* attribute to it.
* @param id
*/
vfunc_set_id(id: string): void;
/**
* Retrieves the orientation of the `orientable`.
* @returns the orientation of the @orientable
*/
get_orientation(): Gtk.Orientation;
/**
* Sets the orientation of the `orientable`.
* @param orientation the orientables new orientation
*/
set_orientation(orientation: Gtk.Orientation | null): 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 WrapLayout {
// Constructor properties interface
interface ConstructorProps extends Gtk.LayoutManager.ConstructorProps, Gtk.Orientable.ConstructorProps {
align: number;
child_spacing: number;
childSpacing: number;
child_spacing_unit: LengthUnit;
childSpacingUnit: LengthUnit;
justify: JustifyMode;
justify_last_line: boolean;
justifyLastLine: boolean;
line_homogeneous: boolean;
lineHomogeneous: boolean;
line_spacing: number;
lineSpacing: number;
line_spacing_unit: LengthUnit;
lineSpacingUnit: LengthUnit;
natural_line_length: number;
naturalLineLength: number;
natural_line_length_unit: LengthUnit;
naturalLineLengthUnit: LengthUnit;
pack_direction: PackDirection;
packDirection: PackDirection;
wrap_policy: WrapPolicy;
wrapPolicy: WrapPolicy;
wrap_reverse: boolean;
wrapReverse: boolean;
}
}
/**
* A box-like layout that can wrap into multiple lines.
*
* <picture>
* <source srcset="wrap-box-dark.png" media="(prefers-color-scheme: dark)">
* <img src="wrap-box.png" alt="wrap-box">
* </picture>
*
* `AdwWrapLayout` is similar to [class`Gtk`.BoxLayout], but can wrap lines when
* the widgets cannot fit otherwise. Unlike [class`Gtk`.FlowBox], the children
* aren't arranged into a grid and behave more like words in a wrapping label.
*
* Like `GtkBoxLayout`, `AdwWrapLayout` is orientable and has spacing:
*
* - [property`WrapLayout:`child-spacing] between children in the same line;
* - [property`WrapLayout:`line-spacing] between lines.
*
* ::: note
* Unlike `GtkBoxLayout`, `AdwWrapLayout` cannot follow the CSS
* `border-spacing` property.
*
* Use the [property`WrapLayout:`natural-line-length] property to determine the
* layout's natural size, e.g. when using it in a [class`Gtk`.Popover].
*
* Normally, a horizontal `AdwWrapLayout` wraps left to right and top to bottom
* for left-to-right languages. Both of these directions can be reversed, using
* the [property`WrapLayout:`pack-direction] and
* [property`WrapLayout:`wrap-reverse] properties. Additionally, the alignment
* of each line can be controlled with the [property`WrapLayout:`align] property.
*
* Lines can be justified using the [property`WrapLayout:`justify] property,
* filling the entire line by either increasing child size or spacing depending
* on the value. Set [property`WrapLayout:`justify-last-line] to justify the last
* line as well.
*
* By default, `AdwWrapLayout` wraps as soon as the previous line cannot fit
* any more children without shrinking them past their natural size. Set
* [property`WrapLayout:`wrap-policy] to [enum`Adw`.WrapPolicy.MINIMUM] to only
* wrap once all the children in the previous line have been shrunk to their
* minimum size.
*
* To make each line take the same amount of space, set
* [property`WrapLayout:`line-homogeneous] to `TRUE`.
*
* Spacing and natural line length can scale with the text scale factor, use the
* [property`WrapLayout:`child-spacing-unit],
* [property`WrapLayout:`line-spacing-unit] and/or
* [property`WrapLayout:`natural-line-length-unit] properties to enable that
* behavior.
*
* See [class`WrapBox]`.
*/
class WrapLayout extends Gtk.LayoutManager implements Gtk.Orientable {
static $gtype: GObject.GType<WrapLayout>;
// Properties
/**
* The alignment of the children within each line.
*
* 0 means the children are placed at the start of the line, 1 means they are
* placed at the end of the line. 0.5 means they are placed in the middle of
* the line.
*
* Alignment is only used when [property`WrapLayout:`justify] is set to
* `ADW_JUSTIFY_NONE`, or on the last line when the
* [property`WrapLayout:`justify-last-line] is `FALSE`.
*/
get align(): number;
set align(val: number);
/**
* The spacing between widgets on the same line.
*
* See [property`WrapLayout:`child-spacing-unit].
*/
get child_spacing(): number;
set child_spacing(val: number);
/**
* The spacing between widgets on the same line.
*
* See [property`WrapLayout:`child-spacing-unit].
*/
get childSpacing(): number;
set childSpacing(val: number);
/**
* The length unit for child spacing.
*
* Allows the spacing to vary depending on the text scale factor.
*
* See [property`WrapLayout:`child-spacing].
*/
get child_spacing_unit(): LengthUnit;
set child_spacing_unit(val: LengthUnit);
/**
* The length unit for child spacing.
*
* Allows the spacing to vary depending on the text scale factor.
*
* See [property`WrapLayout:`child-spacing].
*/
get childSpacingUnit(): LengthUnit;
set childSpacingUnit(val: LengthUnit);
/**
* Determines whether and how each complete line should be stretched to fill
* the entire widget.
*
* If set to `ADW_JUSTIFY_FILL`, each widget in the line will be stretched,
* keeping consistent spacing, so that the line fills the entire widget.
*
* If set to `ADW_JUSTIFY_SPREAD`, the spacing between widgets will be
* increased, keeping widget sizes intact. The first and last widget will be
* aligned with the beginning and end of the line. If the line only contains a
* single widget, it will be stretched regardless.
*
* If set to `ADW_JUSTIFY_NONE`, the line will not be stretched and the
* children will be placed together within the line, according to
* [property`WrapLayout:`align].
*
* By default this doesn't affect the last line, as it will be incomplete. Use
* [property`WrapLayout:`justify-last-line] to justify it as well.
*/
get justify(): JustifyMode;
set justify(val: JustifyMode);
/**
* Whether the last line should be stretched to fill the entire widget.
*
* See [property`WrapLayout:`justify].
*/
get justify_last_line(): boolean;
set justify_last_line(val: boolean);
/**
* Whether the last line should be stretched to fill the entire widget.
*
* See [property`WrapLayout:`justify].
*/
get justifyLastLine(): boolean;
set justifyLastLine(val: boolean);
/**
* Whether all lines should take the same amount of space.
*/
get line_homogeneous(): boolean;
set line_homogeneous(val: boolean);
/**
* Whether all lines should take the same amount of space.
*/
get lineHomogeneous(): boolean;
set lineHomogeneous(val: boolean);
/**
* The spacing between lines.
*
* See [property`WrapLayout:`line-spacing-unit].
*/
get line_spacing(): number;
set line_spacing(val: number);
/**
* The spacing between lines.
*
* See [property`WrapLayout:`line-spacing-unit].
*/
get lineSpacing(): number;
set lineSpacing(val: number);
/**
* The length unit for line spacing.
*
* Allows the spacing to vary depending on the text scale factor.
*
* See [property`WrapLayout:`line-spacing].
*/
get line_spacing_unit(): LengthUnit;
set line_spacing_unit(val: LengthUnit);
/**
* The length unit for line spacing.
*
* Allows the spacing to vary depending on the text scale factor.
*
* See [property`WrapLayout:`line-spacing].
*/
get lineSpacingUnit(): LengthUnit;
set lineSpacingUnit(val: LengthUnit);
/**
* Determines the natural size for each line.
*
* It should be used to limit the line lengths, for example when used in
* popovers.
*
* See [property`WrapLayout:`natural-line-length-unit].
*/
get natural_line_length(): number;
set natural_line_length(val: number);
/**
* Determines the natural size for each line.
*
* It should be used to limit the line lengths, for example when used in
* popovers.
*
* See [property`WrapLayout:`natural-line-length-unit].
*/
get naturalLineLength(): number;
set naturalLineLength(val: number);
/**
* The length unit for natural line length.
*
* Allows the length to vary depending on the text scale factor.
*
* See [property`WrapLayout:`natural-line-length].
*/
get natural_line_length_unit(): LengthUnit;
set natural_line_length_unit(val: LengthUnit);
/**
* The length unit for natural line length.
*
* Allows the length to vary depending on the text scale factor.
*
* See [property`WrapLayout:`natural-line-length].
*/
get naturalLineLengthUnit(): LengthUnit;
set naturalLineLengthUnit(val: LengthUnit);
/**
* The direction children are packed in each line.
*/
get pack_direction(): PackDirection;
set pack_direction(val: PackDirection);
/**
* The direction children are packed in each line.
*/
get packDirection(): PackDirection;
set packDirection(val: PackDirection);
/**
* The policy for line wrapping.
*
* If set to `ADW_WRAP_NATURAL`, the box will wrap to the next line as soon as
* the previous line cannot fit any more children without shrinking them past
* their natural size.
*
* If set to `ADW_WRAP_MINIMUM`, the box will try to fit as many children into
* each line as possible, shrinking them down to their minimum size before
* wrapping to the next line.
*/
get wrap_policy(): WrapPolicy;
set wrap_policy(val: WrapPolicy);
/**
* The policy for line wrapping.
*
* If set to `ADW_WRAP_NATURAL`, the box will wrap to the next line as soon as
* the previous line cannot fit any more children without shrinking them past
* their natural size.
*
* If set to `ADW_WRAP_MINIMUM`, the box will try to fit as many children into
* each line as possible, shrinking them down to their minimum size before
* wrapping to the next line.
*/
get wrapPolicy(): WrapPolicy;
set wrapPolicy(val: WrapPolicy);
/**
* Whether wrap direction should be reversed.
*
* By default, lines wrap downwards in a horizontal box, and towards the end
* in a vertical box. If set to `TRUE`, they wrap upwards or towards the start
* respectively.
*/
get wrap_reverse(): boolean;
set wrap_reverse(val: boolean);
/**
* Whether wrap direction should be reversed.
*
* By default, lines wrap downwards in a horizontal box, and towards the end
* in a vertical box. If set to `TRUE`, they wrap upwards or towards the start
* respectively.
*/
get wrapReverse(): boolean;
set wrapReverse(val: boolean);
// Constructors
constructor(properties?: Partial<WrapLayout.ConstructorProps>, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): WrapLayout;
// Methods
/**
* Gets the alignment of the children within each line.
* @returns the child alignment
*/
get_align(): number;
/**
* Gets spacing between widgets on the same line.
* @returns spacing between widgets on the same line
*/
get_child_spacing(): number;
/**
* Gets the length unit for child spacing.
* @returns the length unit
*/
get_child_spacing_unit(): LengthUnit;
/**
* Gets whether and how each complete line is stretched to fill the entire widget.
* @returns the justify mode
*/
get_justify(): JustifyMode;
/**
* Gets whether the last line should be stretched to fill the entire widget.
* @returns whether the last line is justified
*/
get_justify_last_line(): boolean;
/**
* Gets whether all lines should take the same amount of space.
* @returns whether lines should be homogeneous
*/
get_line_homogeneous(): boolean;
/**
* Gets the spacing between lines.
* @returns the line spacing
*/
get_line_spacing(): number;
/**
* Gets the length unit for line spacing.
* @returns the length unit
*/
get_line_spacing_unit(): LengthUnit;
/**
* Gets the natural size for each line.
* @returns the natural length
*/
get_natural_line_length(): number;
/**
* Gets the length unit for line spacing.
* @returns the length unit
*/
get_natural_line_length_unit(): LengthUnit;
/**
* Gets the direction children are packed in each line.
* @returns the line direction
*/
get_pack_direction(): PackDirection;
/**
* Gets the policy for line wrapping.
* @returns the wrap policy
*/
get_wrap_policy(): WrapPolicy;
/**
* Gets whether wrap direction is reversed.
* @returns whether wrap direction is reversed
*/
get_wrap_reverse(): boolean;
/**
* Sets the alignment of the children within each line.
*
* 0 means the children are placed at the start of the line, 1 means they are
* placed at the end of the line. 0.5 means they are placed in the middle of the
* line.
*
* Alignment is only used when [property`WrapLayout:`justify] is set to
* `ADW_JUSTIFY_NONE`, or on the last line when the
* [property`WrapLayout:`justify-last-line] is `FALSE`.
* @param align the child alignment
*/
set_align(align: number): void;
/**
* Sets the spacing between widgets on the same line.
*
* See [property`WrapLayout:`child-spacing-unit].
* @param child_spacing the child spacing
*/
set_child_spacing(child_spacing: number): void;
/**
* Sets the length unit for child spacing.
*
* Allows the spacing to vary depending on the text scale factor.
*
* See [property`WrapLayout:`child-spacing].
* @param unit the length unit
*/
set_child_spacing_unit(unit: LengthUnit | null): void;
/**
* Sets whether and how each complete line should be stretched to fill the
* entire widget.
*
* If set to `ADW_JUSTIFY_FILL`, each widget in the line will be stretched,
* keeping consistent spacing, so that the line fills the entire widget.
*
* If set to `ADW_JUSTIFY_SPREAD`, the spacing between widgets will be
* increased, keeping widget sizes intact. The first and last widget will be
* aligned with the beginning and end of the line. If the line only contains a
* single widget, it will be stretched regardless.
*
* If set to `ADW_JUSTIFY_NONE`, the line will not be stretched and the children
* will be placed together within the line, according to
* [property`WrapLayout:`align].
*
* By default this doesn't affect the last line, as it will be incomplete. Use
* [property`WrapLayout:`justify-last-line] to justify it as well.
* @param justify the justify mode
*/
set_justify(justify: JustifyMode | null): void;
/**
* Sets whether the last line should be stretched to fill the entire widget.
*
* See [property`WrapLayout:`justify].
* @param justify_last_line whether to justify the last line
*/
set_justify_last_line(justify_last_line: boolean): void;
/**
* Sets whether all lines should take the same amount of space.
* @param homogeneous whether lines should be homogeneous
*/
set_line_homogeneous(homogeneous: boolean): void;
/**
* Sets the spacing between lines.
*
* See [property`WrapLayout:`line-spacing-unit].
* @param line_spacing the line spacing
*/
set_line_spacing(line_spacing: number): void;
/**
* Sets the length unit for line spacing.
*
* Allows the spacing to vary depending on the text scale factor.
*
* See [property`WrapLayout:`line-spacing].
* @param unit the length unit
*/
set_line_spacing_unit(unit: LengthUnit | null): void;
/**
* Sets the natural size for each line.
*
* It should be used to limit the line lengths, for example when used in
* popovers.
*
* See [property`WrapLayout:`natural-line-length-unit].
* @param natural_line_length the natural length
*/
set_natural_line_length(natural_line_length: number): void;
/**
* Sets the length unit for natural line length.
*
* Allows the length to vary depending on the text scale factor.
*
* See [property`WrapLayout:`natural-line-length].
* @param unit the length unit
*/
set_natural_line_length_unit(unit: LengthUnit | null): void;
/**
* Sets the direction children are packed in each line.
* @param pack_direction the new line direction
*/
set_pack_direction(pack_direction: PackDirection | null): void;
/**
* Sets the policy for line wrapping.
*
* If set to `ADW_WRAP_NATURAL`, the box will wrap to the next line as soon as
* the previous line cannot fit any more children without shrinking them past
* their natural size.
*
* If set to `ADW_WRAP_MINIMUM`, the box will try to fit as many children into
* each line as possible, shrinking them down to their minimum size before
* wrapping to the next line.
* @param wrap_policy the new wrap policy
*/
set_wrap_policy(wrap_policy: WrapPolicy | null): void;
/**
* Sets whether wrap direction should be reversed.
*
* By default, lines wrap downwards in a horizontal box, and towards the end
* in a vertical box. If set to `TRUE`, they wrap upwards or towards the start
* respectively.
* @param wrap_reverse whether to reverse wrap direction
*/
set_wrap_reverse(wrap_reverse: boolean): void;
// Inherited properties
/**
* The orientation of the orientable.
*/
get orientation(): Gtk.Orientation;
set orientation(val: Gtk.Orientation);
// Inherited methods
/**
* Retrieves the orientation of the `orientable`.
* @returns the orientation of the @orientable
*/
get_orientation(): Gtk.Orientation;
/**
* Sets the orientation of the `orientable`.
* @param orientation the orientables new orientation
*/
set_orientation(orientation: Gtk.Orientation | null): 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;
}
type AboutDialogClass = typeof AboutDialog;
type AboutWindowClass = typeof AboutWindow;
type ActionRowClass = typeof ActionRow;
type AlertDialogClass = typeof AlertDialog;
type AnimationClass = typeof Animation;
type AnimationTargetClass = typeof AnimationTarget;
type ApplicationClass = typeof Application;
type ApplicationWindowClass = typeof ApplicationWindow;
type AvatarClass = typeof Avatar;
type BannerClass = typeof Banner;
type BinClass = typeof Bin;
type BottomSheetClass = typeof BottomSheet;
type BreakpointBinClass = typeof BreakpointBin;
type BreakpointClass = typeof Breakpoint;
/**
* Describes condition for an [class`Breakpoint]`.
*/
class BreakpointCondition {
static $gtype: GObject.GType<BreakpointCondition>;
// Constructors
constructor(condition_1: BreakpointCondition, condition_2: BreakpointCondition);
_init(...args: any[]): void;
static new_and(condition_1: BreakpointCondition, condition_2: BreakpointCondition): BreakpointCondition;
static new_length(
type: BreakpointConditionLengthType,
value: number,
unit: LengthUnit,
): BreakpointCondition;
static new_or(condition_1: BreakpointCondition, condition_2: BreakpointCondition): BreakpointCondition;
static new_ratio(type: BreakpointConditionRatioType, width: number, height: number): BreakpointCondition;
// Static methods
/**
* Parses a condition from a string.
*
* Length conditions are specified as `<type>: <value>[<unit>]`, where:
*
* - `<type>` can be `min-width`, `max-width`, `min-height` or `max-height`
* - `<value>` is a fractional number
* - `<unit>` can be `px`, `pt` or `sp`
*
* If the unit is omitted, `px` is assumed.
*
* See [ctor`BreakpointCondition`.new_length].
*
* Examples:
*
* - `min-width: 500px`
* - `min-height: 400pt`
* - `max-width: 100sp`
* - `max-height: 500`
*
* Ratio conditions are specified as `<type>: <width>[/<height>]`, where:
*
* - `<type>` can be `min-aspect-ratio` or `max-aspect-ratio`
* - `<width>` and `<height>` are integer numbers
*
* See [ctor`BreakpointCondition`.new_ratio].
*
* The ratio is represented as `<width>` divided by `<height>`.
*
* If `<height>` is omitted, it's assumed to be 1.
*
* Examples:
*
* - `min-aspect-ratio: 4/3`
* - `max-aspect-ratio: 1`
*
* The logical operators `and`, `or` can be used to compose a complex condition
* as follows:
*
* - `<condition> and <condition>`: the condition is true when both
* `<condition>`s are true, same as when using
* [ctor`BreakpointCondition`.new_and]
* - `<condition> or <condition>`: the condition is true when either of the
* `<condition>`s is true, same as when using
* [ctor`BreakpointCondition`.new_or]
*
* Examples:
*
* - `min-width: 400px and max-aspect-ratio: 4/3`
* - `max-width: 360sp or max-width: 360px`
*
* Conditions can be further nested using parentheses, for example:
*
* - `min-width: 400px and (max-aspect-ratio: 4/3 or max-height: 400px)`
*
* If parentheses are omitted, the first operator takes priority.
* @param str the string specifying the condition
*/
static parse(str: string): BreakpointCondition;
// Methods
/**
* Copies `self`.
* @returns a copy of @self
*/
copy(): BreakpointCondition;
/**
* Frees `self`.
*/
free(): void;
/**
* Returns a textual representation of `self`.
*
* The returned string can be parsed by [func`BreakpointCondition`.parse].
* @returns A newly allocated text string
*/
to_string(): string;
}
type ButtonContentClass = typeof ButtonContent;
type ButtonRowClass = typeof ButtonRow;
type CallbackAnimationTargetClass = typeof CallbackAnimationTarget;
type CarouselClass = typeof Carousel;
type CarouselIndicatorDotsClass = typeof CarouselIndicatorDots;
type CarouselIndicatorLinesClass = typeof CarouselIndicatorLines;
type ClampClass = typeof Clamp;
type ClampLayoutClass = typeof ClampLayout;
type ClampScrollableClass = typeof ClampScrollable;
type ComboRowClass = typeof ComboRow;
type DialogClass = typeof Dialog;
type EntryRowClass = typeof EntryRow;
type EnumListItemClass = typeof EnumListItem;
type EnumListModelClass = typeof EnumListModel;
type ExpanderRowClass = typeof ExpanderRow;
type FlapClass = typeof Flap;
type HeaderBarClass = typeof HeaderBar;
type InlineViewSwitcherClass = typeof InlineViewSwitcher;
type LayoutClass = typeof Layout;
type LayoutSlotClass = typeof LayoutSlot;
type LeafletClass = typeof Leaflet;
type LeafletPageClass = typeof LeafletPage;
type MessageDialogClass = typeof MessageDialog;
type MultiLayoutViewClass = typeof MultiLayoutView;
type NavigationPageClass = typeof NavigationPage;
type NavigationSplitViewClass = typeof NavigationSplitView;
type NavigationViewClass = typeof NavigationView;
type OverlaySplitViewClass = typeof OverlaySplitView;
type PasswordEntryRowClass = typeof PasswordEntryRow;
type PreferencesDialogClass = typeof PreferencesDialog;
type PreferencesGroupClass = typeof PreferencesGroup;
type PreferencesPageClass = typeof PreferencesPage;
type PreferencesRowClass = typeof PreferencesRow;
type PreferencesWindowClass = typeof PreferencesWindow;
type PropertyAnimationTargetClass = typeof PropertyAnimationTarget;
type SpinRowClass = typeof SpinRow;
type SpinnerClass = typeof Spinner;
type SpinnerPaintableClass = typeof SpinnerPaintable;
type SplitButtonClass = typeof SplitButton;
type SpringAnimationClass = typeof SpringAnimation;
/**
* Physical parameters of a spring for [class`SpringAnimation]`.
*
* Any spring can be described by three parameters: mass, stiffness and damping.
*
* An undamped spring will produce an oscillatory motion which will go on
* forever.
*
* The frequency and amplitude of the oscillations will be determined by the
* stiffness (how "strong" the spring is) and its mass (how much "inertia" it
* has).
*
* If damping is larger than 0, the amplitude of that oscillating motion will
* exponientally decrease over time. If that damping is strong enough that the
* spring can't complete a full oscillation, it's called an overdamped spring.
*
* If we the spring can oscillate, it's called an underdamped spring.
*
* The value between these two behaviors is called critical damping; a
* critically damped spring will comes to rest in the minimum possible time
* without producing oscillations.
*
* The damping can be replaced by damping ratio, which produces the following
* springs:
*
* * 0: an undamped spring.
* * Between 0 and 1: an underdamped spring.
* * 1: a critically damped spring.
* * Larger than 1: an overdamped spring.
*
* As such
*/
class SpringParams {
static $gtype: GObject.GType<SpringParams>;
// Constructors
constructor(damping_ratio: number, mass: number, stiffness: number);
_init(...args: any[]): void;
static ['new'](damping_ratio: number, mass: number, stiffness: number): SpringParams;
static new_full(damping: number, mass: number, stiffness: number): SpringParams;
// Methods
/**
* Gets the damping of `self`.
* @returns the damping
*/
get_damping(): number;
/**
* Gets the damping ratio of `self`.
* @returns the damping ratio
*/
get_damping_ratio(): number;
/**
* Gets the mass of `self`.
* @returns the mass
*/
get_mass(): number;
/**
* Gets the stiffness of `self`.
* @returns the stiffness
*/
get_stiffness(): number;
/**
* Increases the reference count of `self`.
* @returns @self
*/
ref(): SpringParams;
/**
* Decreases the reference count of `self`.
*
* If the last reference is dropped, the structure is freed.
*/
unref(): void;
}
type SqueezerClass = typeof Squeezer;
type SqueezerPageClass = typeof SqueezerPage;
type StatusPageClass = typeof StatusPage;
type StyleManagerClass = typeof StyleManager;
type SwipeTrackerClass = typeof SwipeTracker;
type SwipeableInterface = typeof Swipeable;
type SwitchRowClass = typeof SwitchRow;
type TabBarClass = typeof TabBar;
type TabButtonClass = typeof TabButton;
type TabOverviewClass = typeof TabOverview;
type TabPageClass = typeof TabPage;
type TabViewClass = typeof TabView;
type TimedAnimationClass = typeof TimedAnimation;
type ToastClass = typeof Toast;
type ToastOverlayClass = typeof ToastOverlay;
type ToggleClass = typeof Toggle;
type ToggleGroupClass = typeof ToggleGroup;
type ToolbarViewClass = typeof ToolbarView;
type ViewStackClass = typeof ViewStack;
type ViewStackPageClass = typeof ViewStackPage;
type ViewStackPagesClass = typeof ViewStackPages;
type ViewSwitcherBarClass = typeof ViewSwitcherBar;
type ViewSwitcherClass = typeof ViewSwitcher;
type ViewSwitcherTitleClass = typeof ViewSwitcherTitle;
type WindowClass = typeof Window;
type WindowTitleClass = typeof WindowTitle;
type WrapBoxClass = typeof WrapBox;
type WrapLayoutClass = typeof WrapLayout;
namespace Swipeable {
// Constructor properties interface
interface ConstructorProps extends Gtk.Widget.ConstructorProps {}
}
export interface SwipeableNamespace {
$gtype: GObject.GType<Swipeable>;
prototype: Swipeable;
}
interface Swipeable extends Gtk.Widget {
// Methods
/**
* Gets the progress `self` will snap back to after the gesture is canceled.
* @returns the cancel progress, unitless
*/
get_cancel_progress(): number;
/**
* Gets the swipe distance of `self`.
*
* This corresponds to how many pixels 1 unit represents.
* @returns the swipe distance in pixels
*/
get_distance(): number;
/**
* Gets the current progress of `self`.
* @returns the current progress, unitless
*/
get_progress(): number;
/**
* Gets the snap points of `self`.
*
* Each snap point represents a progress value that is considered acceptable to
* end the swipe on.
* @returns the snap points
*/
get_snap_points(): number[];
/**
* Gets the area `self` can start a swipe from for the given direction and
* gesture type.
*
* This can be used to restrict swipes to only be possible from a certain area,
* for example, to only allow edge swipes, or to have a draggable element and
* ignore swipes elsewhere.
*
* If not implemented, the default implementation returns the allocation of
* `self,` allowing swipes from anywhere.
* @param navigation_direction the direction of the swipe
* @param is_drag whether the swipe is caused by a dragging gesture
*/
get_swipe_area(navigation_direction: NavigationDirection | null, is_drag: boolean): Gdk.Rectangle;
// Virtual methods
/**
* Gets the progress `self` will snap back to after the gesture is canceled.
*/
vfunc_get_cancel_progress(): number;
/**
* Gets the swipe distance of `self`.
*
* This corresponds to how many pixels 1 unit represents.
*/
vfunc_get_distance(): number;
/**
* Gets the current progress of `self`.
*/
vfunc_get_progress(): number;
/**
* Gets the snap points of `self`.
*
* Each snap point represents a progress value that is considered acceptable to
* end the swipe on.
*/
vfunc_get_snap_points(): number[];
/**
* Gets the area `self` can start a swipe from for the given direction and
* gesture type.
*
* This can be used to restrict swipes to only be possible from a certain area,
* for example, to only allow edge swipes, or to have a draggable element and
* ignore swipes elsewhere.
*
* If not implemented, the default implementation returns the allocation of
* `self,` allowing swipes from anywhere.
* @param navigation_direction the direction of the swipe
* @param is_drag whether the swipe is caused by a dragging gesture
*/
vfunc_get_swipe_area(navigation_direction: NavigationDirection, is_drag: boolean): Gdk.Rectangle;
}
export const Swipeable: SwipeableNamespace & {
new (): Swipeable; // This allows `obj instanceof Swipeable`
};
/**
* Name of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
*/
const __name__: string;
/**
* Version of the imported GIR library
* `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
*/
const __version__: string;
}
export default Adw;
}
declare module 'gi://Adw' {
import Adw1 from 'gi://Adw?version=1';
export default Adw1;
}
// END